public load ( string $pathAndFilename, boolean $allowSplitSource = false ) : array | ||
$pathAndFilename | string | Full path and filename of the file to load, excluding the file extension (ie. ".yaml") |
$allowSplitSource | boolean | If TRUE, the type will be used as a prefix when looking for configuration files |
return | array |
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;
}
/** * Loads the specified configuration file and returns its content as an * array. If the file does not exist or could not be loaded, an empty * array is returned * * @param string $pathAndFilename Full path and filename of the file to load, excluding the file extension (ie. ".yaml") * @param boolean $allowSplitSource If TRUE, the type will be used as a prefix when looking for configuration files * @return array * @throws \Neos\Flow\Configuration\Exception\ParseErrorException */ public function load($pathAndFilename, $allowSplitSource = false) { if (strpos($pathAndFilename, FLOW_PATH_CONFIGURATION) === 0) { return []; } else { return parent::load($pathAndFilename, $allowSplitSource); } }