Neos\Flow\Core\Migrations\AbstractMigration::processConfiguration PHP Method

processConfiguration() protected method

Apply the given processor to the raw results of loading the given configuration type for the package from YAML. If multiple files exist (context configuration) all are processed independently.
protected processConfiguration ( string $configurationType, Closure $processor, boolean $saveResult = false ) : void
$configurationType string One of ConfigurationManager::CONFIGURATION_TYPE_*
$processor Closure
$saveResult boolean
return void
    protected function processConfiguration($configurationType, \Closure $processor, $saveResult = false)
    {
        if (is_dir($this->targetPackageData['path'] . '/Configuration') === false) {
            return;
        }
        $yamlPathsAndFilenames = Files::readDirectoryRecursively($this->targetPackageData['path'] . '/Configuration', 'yaml', true);
        $configurationPathsAndFilenames = array_filter($yamlPathsAndFilenames, function ($pathAndFileName) use($configurationType) {
            if (strpos(basename($pathAndFileName, '.yaml'), $configurationType) === 0) {
                return true;
            } else {
                return false;
            }
        });
        $yamlSource = new YamlSource();
        foreach ($configurationPathsAndFilenames as $pathAndFilename) {
            $originalConfiguration = $configuration = $yamlSource->load(substr($pathAndFilename, 0, -5));
            $processor($configuration);
            if ($saveResult === true && $configuration !== $originalConfiguration) {
                $yamlSource->save(substr($pathAndFilename, 0, -5), $configuration);
            }
        }
    }