| Total Complexity | 5 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | final class AppConfigBuilder |
||
| 14 | { |
||
| 15 | /** @var list<GacelaConfigItem> */ |
||
| 16 | private array $configItems = []; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param string $path define the path where Gacela will read all the config files |
||
| 20 | * @param string $pathLocal define the path where Gacela will read the local config file |
||
| 21 | * @param class-string<ConfigReaderInterface>|ConfigReaderInterface|null $reader Define the reader class which will read and parse the config files |
||
|
|
|||
| 22 | */ |
||
| 23 | 25 | public function add(string $path, string $pathLocal = '', string|ConfigReaderInterface $reader = null): self |
|
| 24 | { |
||
| 25 | 25 | $readerInstance = $this->normalizeReader($reader); |
|
| 26 | |||
| 27 | 25 | $this->configItems[] = new GacelaConfigItem($path, $pathLocal, $readerInstance); |
|
| 28 | |||
| 29 | 25 | return $this; |
|
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @return list<GacelaConfigItem> |
||
| 34 | */ |
||
| 35 | 69 | public function build(): array |
|
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @param class-string<ConfigReaderInterface>|ConfigReaderInterface|null $reader |
||
| 42 | */ |
||
| 43 | 25 | private function normalizeReader(string|ConfigReaderInterface|null $reader): ConfigReaderInterface |
|
| 56 |