| Total Complexity | 4 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | class BasePathPrefixer |
||
| 10 | { |
||
| 11 | private const ELEMENTS_WITH_PATH = ['routes', 'middleware_pipeline']; |
||
| 12 | |||
| 13 | 3 | public function __invoke(array $config): array |
|
| 14 | { |
||
| 15 | 3 | $basePath = $config['router']['base_path'] ?? ''; |
|
| 16 | 3 | $config['url_shortener']['domain']['hostname'] .= $basePath; |
|
| 17 | |||
| 18 | 3 | foreach (self::ELEMENTS_WITH_PATH as $configKey) { |
|
| 19 | 3 | $config[$configKey] = $this->prefixPathsWithBasePath($configKey, $config, $basePath); |
|
| 20 | } |
||
| 21 | |||
| 22 | 3 | return $config; |
|
| 23 | } |
||
| 24 | |||
| 25 | 3 | private function prefixPathsWithBasePath(string $configKey, array $config, string $basePath): array |
|
| 34 | 3 | }); |
|
| 35 | } |
||
| 37 |