Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove SettingsProvider #13

Merged
merged 2 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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