eZ\Publish\Core\Repository\Helper\NameSchemaService::filterNameSchema PHP Method

filterNameSchema() protected method

The groups are referenced with a generated meta-token in the original name pattern. Returns intermediate name pattern where groups are replaced with meta- tokens.
protected filterNameSchema ( string $nameSchema ) : string
$nameSchema string
return string
    protected function filterNameSchema($nameSchema)
    {
        $retNamePattern = '';
        $foundGroups = preg_match_all('/[<|\\|](\\(.+\\))[\\||>]/U', $nameSchema, $groupArray);
        $groupLookupTable = array();
        if ($foundGroups) {
            $i = 0;
            foreach ($groupArray[1] as $group) {
                // Create meta-token for group
                $metaToken = self::META_STRING . $i;
                // Insert the group with its placeholder token
                $retNamePattern = str_replace($group, $metaToken, $nameSchema);
                // Remove the pattern "(" ")" from the tokens
                $group = str_replace(array('(', ')'), '', $group);
                $groupLookupTable[$metaToken] = $group;
                ++$i;
            }
            $nameSchema = $retNamePattern;
        }
        return array($nameSchema, $groupLookupTable);
    }