| Conditions | 6 |
| Paths | 7 |
| Total Lines | 27 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 13 | public function getExtraHostnameConfigurations(Project $project) |
||
| 14 | { |
||
| 15 | $composerFile = $this->getComposerJsonFilePath($project); |
||
| 16 | if (!file_exists($composerFile)) { |
||
| 17 | return []; |
||
| 18 | } |
||
| 19 | |||
| 20 | $contents = json_decode(file_get_contents($composerFile), true); |
||
| 21 | $accessor = PropertyAccess::createPropertyAccessor(); |
||
| 22 | $componentsConfiguration = $accessor->getValue($contents, '[extra][dock-cli][extra-hostname]'); |
||
| 23 | if (!is_array($componentsConfiguration)) { |
||
| 24 | return []; |
||
| 25 | } |
||
| 26 | |||
| 27 | $configurations = []; |
||
| 28 | foreach ($componentsConfiguration as $componentName => $hostNames) { |
||
| 29 | if (!is_array($hostNames)) { |
||
| 30 | $hostNames = [$hostNames]; |
||
| 31 | } |
||
| 32 | |||
| 33 | foreach ($hostNames as $hostname) { |
||
| 34 | $configurations[] = new HostnameConfiguration($componentName, $hostname); |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | return $configurations; |
||
| 39 | } |
||
| 40 | |||
| 51 |