public function load($pathAndFilename, $allowSplitSource = false)
{
$pathsAndFileNames = [$pathAndFilename . '.yaml'];
if ($allowSplitSource === true) {
$splitSourcePathsAndFileNames = glob($pathAndFilename . '.*.yaml');
if ($splitSourcePathsAndFileNames !== false) {
sort($splitSourcePathsAndFileNames);
$pathsAndFileNames = array_merge($pathsAndFileNames, $splitSourcePathsAndFileNames);
}
}
$configuration = [];
foreach ($pathsAndFileNames as $pathAndFilename) {
if (is_file($pathAndFilename)) {
try {
if ($this->usePhpYamlExtension) {
if (strpos($pathAndFilename, 'resource://') === 0) {
$yaml = file_get_contents($pathAndFilename);
$loadedConfiguration = @yaml_parse($yaml);
unset($yaml);
} else {
$loadedConfiguration = @yaml_parse_file($pathAndFilename);
}
if ($loadedConfiguration === false) {
throw new ParseErrorException('A parse error occurred while parsing file "' . $pathAndFilename . '".', 1391894094);
}
} else {
$loadedConfiguration = Yaml::parse($pathAndFilename);
}
if (is_array($loadedConfiguration)) {
$configuration = Arrays::arrayMergeRecursiveOverrule($configuration, $loadedConfiguration);
}
} catch (Exception $exception) {
throw new ParseErrorException('A parse error occurred while parsing file "' . $pathAndFilename . '". Error message: ' . $exception->getMessage(), 1232014321);
}
}
}
return $configuration;
}