Back to FeedParser class

Method fetchNamespace

protected mixed
fetchNamespace
(mixed $prefix)
Method to get a namespace object for a given namespace prefix.
Parameters
  • string $prefix The XML prefix for which to fetch the namespace object.
Returns
  • mixed NamespaceParserInterface or false if none exists.
Since
  • 3.1.4
Class: FeedParser
Project: Joomla

Method fetchNamespace - Source code

/**
 * Method to get a namespace object for a given namespace prefix.
 *
 * @param   string  $prefix  The XML prefix for which to fetch the namespace object.
 *
 * @return  mixed  NamespaceParserInterface or false if none exists.
 *
 * @since   3.1.4
 */
protected function fetchNamespace($prefix)
{
    if (isset($this->namespaces[$prefix])) {
        return $this->namespaces[$prefix];
    }
    $className = \get_class($this) . ucfirst($prefix);
    if (class_exists($className)) {
        $this->namespaces[$prefix] = new $className();
        return $this->namespaces[$prefix];
    }
    return false;
}