ArrayUtil.php
3 years ago
Config.php
3 years ago
ConfigCollection.php
3 years ago
ConfigCollectionFactory.php
3 years ago
ConfigCollectionInterface.php
3 years ago
ConfigFactory.php
3 years ago
ConfigInterface.php
3 years ago
Filesystem.php
3 years ago
FilesystemInterface.php
3 years ago
Imposter.php
3 years ago
ImposterFactory.php
3 years ago
ImposterInterface.php
3 years ago
ProjectConfig.php
3 years ago
ProjectConfigInterface.php
3 years ago
StringUtil.php
3 years ago
Transformer.php
3 years ago
TransformerInterface.php
3 years ago
ConfigFactory.php
31 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace TypistTech\Imposter; |
| 6 | |
| 7 | class ConfigFactory |
| 8 | { |
| 9 | public static function build(string $path, Filesystem $filesystem): Config |
| 10 | { |
| 11 | return new Config( |
| 12 | $filesystem->dirname($path), |
| 13 | json_decode( |
| 14 | $filesystem->get($path), |
| 15 | true |
| 16 | ) |
| 17 | ); |
| 18 | } |
| 19 | |
| 20 | public static function buildProjectConfig(string $path, Filesystem $filesystem): ProjectConfig |
| 21 | { |
| 22 | return new ProjectConfig( |
| 23 | $filesystem->dirname($path), |
| 24 | json_decode( |
| 25 | $filesystem->get($path), |
| 26 | true |
| 27 | ) |
| 28 | ); |
| 29 | } |
| 30 | } |
| 31 |