Skip to content

Commit

Permalink
Merge pull request #2 from WendellAdriel/config-refactor
Browse files Browse the repository at this point in the history
Refactor Config for Themes
  • Loading branch information
JustSteveKing committed May 16, 2023
2 parents 247de8f + 536c0c5 commit fcedd4b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/Configuration/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,24 @@

namespace Minicli\Framework\Configuration;

use Minicli\Framework\Theme\ThemeContract;

final class Config
{
/**
* @param string $path
* @param class-string<ThemeContract>|null $theme
* @param bool $debug
*/
public function __construct(
private readonly string $path,
private readonly string $theme = '',
private readonly ?string $theme = null,
private readonly bool $debug = false,
) {
}

/**
* @return array{path:string,theme:string,debug:bool}
* @return array{path:string,theme:class-string<ThemeContract>|null,debug:bool}
*/
public function toArray(): array
{
Expand All @@ -26,7 +33,7 @@ public function toArray(): array
}

/**
* @param array{path:string,theme:string,debug:bool|null} $data
* @param array{path:string,theme:class-string<ThemeContract>|null,debug:bool|null} $data
* @return Config
*/
public static function make(array $data): Config
Expand Down
9 changes: 8 additions & 1 deletion src/Minicli.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Minicli\Framework;

use Minicli\Framework\Configuration\Config;
use Minicli\Framework\Theme\ThemeContract;

final class Minicli
{
Expand All @@ -15,9 +16,15 @@ public function __construct(
) {
}

/**
* @param string $path
* @param class-string<ThemeContract>|null $theme
* @param bool $debug
* @return Minicli
*/
public static function boot(
string $path,
string $theme,
?string $theme,
bool $debug = false,
): Minicli {
$config = new Config(
Expand Down

0 comments on commit fcedd4b

Please sign in to comment.