| Total Complexity | 7 |
| Total Lines | 43 |
| Duplicated Lines | 0 % |
| Coverage | 0% |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | final class ConsoleConfig extends AbstractConfig |
||
| 12 | { |
||
| 13 | public function getFacadeMakerTemplate(): string |
||
| 14 | { |
||
| 15 | return $this->getCommandTemplateContent('facade-maker.txt'); |
||
| 16 | } |
||
| 17 | |||
| 18 | public function getFactoryMakerTemplate(): string |
||
| 21 | } |
||
| 22 | |||
| 23 | public function getConfigMakerTemplate(): string |
||
| 24 | { |
||
| 25 | return $this->getCommandTemplateContent('config-maker.txt'); |
||
| 26 | } |
||
| 27 | |||
| 28 | public function getDependencyProviderMakerTemplate(): string |
||
| 29 | { |
||
| 30 | return $this->getCommandTemplateContent('dependency-provider-maker.txt'); |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @throws JsonException |
||
| 35 | * |
||
| 36 | * @return array{autoload: array{psr-4: array<string,string>}} |
||
| 37 | */ |
||
| 38 | public function getComposerJsonContentAsArray(): array |
||
| 39 | { |
||
| 40 | $filename = $this->getAppRootDir() . '/composer.json'; |
||
| 41 | if (!file_exists($filename)) { |
||
| 42 | throw new LogicException('composer.json file not found but it is required'); |
||
| 43 | } |
||
| 44 | |||
| 45 | /** @var array{autoload: array{psr-4: array<string,string>}} $json */ |
||
| 46 | $json = (array)json_decode((string)file_get_contents($filename), true, 512, JSON_THROW_ON_ERROR); |
||
| 47 | |||
| 48 | return $json; |
||
| 49 | } |
||
| 50 | |||
| 51 | private function getCommandTemplateContent(string $filename): string |
||
| 54 | } |
||
| 55 | } |
||
| 56 |