Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
Fix PSR2 and rename files
Browse files Browse the repository at this point in the history
  • Loading branch information
callapa committed Jan 20, 2020
1 parent 4f0264a commit 7af3e06
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
declare(strict_types=1);

namespace Centreon\Domain\Gorgone;
namespace Centreon\Domain\ConfigurationLoader;

use Symfony\Component\Yaml\Tag\TaggedValue;
use Symfony\Component\Yaml\Yaml;
Expand All @@ -38,7 +38,7 @@ class YamlConfigurationLoader
*/
private $configurationFile;

public function __construct (string $configurationFile)
public function __construct(string $configurationFile)
{
$this->configurationFile = $configurationFile;
}
Expand Down Expand Up @@ -68,12 +68,15 @@ public function load(): array
* @return array Returns the configuration data including other configuration data from the include files
* @throws \FileNotFoundException
*/
private function iterateConfiguration(array $configuration, string $currentDirectory, string $historyLoadedFile): array
{
private function iterateConfiguration(
array $configuration,
string $currentDirectory,
string $historyLoadedFile
): array {
foreach ($configuration as $key => $value) {
if (is_array($value)) {
$configuration[$key] = $this->iterateConfiguration($value, $currentDirectory, $historyLoadedFile);
} else if ($value instanceof TaggedValue) {
} elseif ($value instanceof TaggedValue) {
$fileToLoad = $value->getValue();
if ($fileToLoad[0] !== DIRECTORY_SEPARATOR) {
$fileToLoad = $currentDirectory . '/' . $fileToLoad;
Expand All @@ -90,7 +93,6 @@ private function iterateConfiguration(array $configuration, string $currentDirec
$loadedFile = explode(':', $historyLoadedFile);
throw new \Exception('Loop detected in file ' . array_pop($loadedFile));
}

}
}
return $configuration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Centreon\Domain\Gorgone;
namespace Centreon\Domain\ConfigurationLoader;

use PHPUnit\Framework\TestCase;

Expand Down

0 comments on commit 7af3e06

Please sign in to comment.