Skip to content

Commit

Permalink
Remove SettingsProvider (#13)
Browse files Browse the repository at this point in the history
* Remove `SettingsProvider`
* Some improvements to the PluginTest
  • Loading branch information
tfirdaus authored Sep 29, 2024
1 parent 94ea84a commit 2375eba
Show file tree
Hide file tree
Showing 14 changed files with 118 additions and 1,011 deletions.
22 changes: 5 additions & 17 deletions app/Core/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,25 @@

namespace Codex\Core;

use Codex\Foundation\Settings\Registry;
use Syntatis\Utils\Val;

final class App
{
private string $name;

/** @var array<string,Registry> */
private array $settingRegistries = [];
private Config $config;

/** @param array<string,Registry> $settingRegistries */
public function __construct(string $name, array $settingRegistries = [])
public function __construct(string $name, Config $config)
{
$this->name = $name;
$this->settingRegistries = $settingRegistries;
$this->config = $config;
}

public function name(): string
{
return $this->name;
}

/** @return array<string,Registry>|Registry|null */
public function settings(?string $group = null)
public function config(): Config
{
if (! Val::isBlank($group)) {
$group = $this->name . '/' . $group;

return $this->settingRegistries[$group] ?? null;
}

return $this->settingRegistries;
return $this->config;
}
}
4 changes: 2 additions & 2 deletions app/Facades/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
namespace Codex\Facades;

use Codex\Abstracts\Facade;
use Codex\Foundation\Settings\Registry;
use Codex\Core\Config;

/**
* @method static string name() Retrieve the application name.
* @method static array<string,Registry>|Registry|null settings(?string $group = null) Retrieve the setting registry collection.
* @method static Config config() Retrieve the app config object.
*/
final class App extends Facade
{
Expand Down
20 changes: 0 additions & 20 deletions app/Facades/Config.php

This file was deleted.

92 changes: 0 additions & 92 deletions app/Foundation/Settings/Registry.php

This file was deleted.

144 changes: 0 additions & 144 deletions app/Foundation/Settings/Setting.php

This file was deleted.

73 changes: 0 additions & 73 deletions app/Foundation/Settings/Support/SettingRegistrar.php

This file was deleted.

Loading

0 comments on commit 2375eba

Please sign in to comment.