-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
249 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
vendor/ | ||
.idea/ | ||
ssl-cert/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tarach\SelfSignedCert\Command\Config; | ||
|
||
class ConfigSchema | ||
{ | ||
public function __construct( | ||
private readonly array $config | ||
) { | ||
} | ||
|
||
public function hasSchema(string $name): bool | ||
{ | ||
return array_key_exists($name, $this->config); | ||
} | ||
|
||
public function getConfig(string $name): Config | ||
{ | ||
if (!$this->hasSchema($name)) { | ||
throw new \InvalidArgumentException(sprintf('Schema [%s] is not defined in config.', $name)); | ||
} | ||
|
||
return new Config($this->config[$name]); | ||
} | ||
|
||
public function getAllSchemas(): array | ||
{ | ||
return array_keys($this->config); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tarach\SelfSignedCert\Command\Option; | ||
|
||
use Symfony\Component\Console\Input\InputOption; | ||
|
||
class SchemaOption extends AbstractInputOption | ||
{ | ||
public const NAME = 'schema'; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct( | ||
self::NAME, | ||
'e', | ||
InputOption::VALUE_REQUIRED, | ||
'Name or number of configuration schema to use.', | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.