Jackalope\ImportExport\ImportExport::cleanNamespace PHP Method

cleanNamespace() private static method

Helper function for importing to ensure prefix is same as in repository
private static cleanNamespace ( string $name, array $namespaceMap ) : string
$name string potentially namespace prefixed xml name
$namespaceMap array of document prefix => repository prefix
return string
    private static function cleanNamespace($name, array $namespaceMap)
    {
        if ($pos = strpos($name, ':')) {
            // map into repo namespace prefix
            $prefix = substr($name, 0, $pos);
            if (array_key_exists($prefix, $namespaceMap)) {
                // the values we remap are not xml names but attribute values.
                // the namespace declaration is not obligatory
                str_replace($prefix, $namespaceMap[$prefix], $name);
            }
        }
        return $name;
    }