Neos\Flow\I18n\Cldr\CldrModel::resolveAliases PHP Méthode

resolveAliases() protected méthode

CLDR uses 'alias' tag which denotes places where data should be copied from. This tag has 'source' attribute pointing (by relative XPath query) to the source node - it should be copied with all it's children.
protected resolveAliases ( mixed $data, string $currentPath ) : mixed
$data mixed Part of internal array to resolve aliases for (string if leaf, array otherwise)
$currentPath string Path to currently analyzed part of data
Résultat mixed Modified (or unchanged) $data
    protected function resolveAliases($data, $currentPath)
    {
        if (!is_array($data)) {
            return $data;
        }
        foreach ($data as $nodeString => $nodeChildren) {
            if (self::getNodeName($nodeString) === 'alias') {
                if (self::getAttributeValue($nodeString, 'source') !== 'locale') {
                    // Value of source attribute can be 'locale' or particular locale identifier, but we do not support the second mode, ignore it silently
                    break;
                }
                $sourcePath = self::getAttributeValue($nodeString, 'path');
                // Change relative path to absolute one
                $sourcePath = str_replace('../', '', $sourcePath, $countOfJumpsToParentNode);
                $sourcePath = str_replace('\'', '"', $sourcePath);
                $currentPathNodeNames = explode('/', $currentPath);
                for ($i = 0; $i < $countOfJumpsToParentNode; ++$i) {
                    unset($currentPathNodeNames[count($currentPathNodeNames) - 1]);
                }
                $sourcePath = implode('/', $currentPathNodeNames) . '/' . $sourcePath;
                unset($data[$nodeString]);
                $sourceData = $this->getRawData($sourcePath);
                if (is_array($sourceData)) {
                    $data = array_merge($sourceData, $data);
                }
                break;
            } else {
                $data[$nodeString] = $this->resolveAliases($data[$nodeString], $currentPath === '' ? $nodeString : $currentPath . '/' . $nodeString);
            }
        }
        return $data;
    }