You are here

protected function Twig_Loader_Filesystem::parseName in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/twig/twig/lib/Twig/Loader/Filesystem.php \Twig_Loader_Filesystem::parseName()
1 call to Twig_Loader_Filesystem::parseName()
Twig_Loader_Filesystem::findTemplate in vendor/twig/twig/lib/Twig/Loader/Filesystem.php

File

vendor/twig/twig/lib/Twig/Loader/Filesystem.php, line 218

Class

Twig_Loader_Filesystem
Loads template from the filesystem.

Code

protected function parseName($name, $default = self::MAIN_NAMESPACE) {
  if (isset($name[0]) && '@' == $name[0]) {
    if (false === ($pos = strpos($name, '/'))) {
      throw new Twig_Error_Loader(sprintf('Malformed namespaced template name "%s" (expecting "@namespace/template_name").', $name));
    }
    $namespace = substr($name, 1, $pos - 1);
    $shortname = substr($name, $pos + 1);
    return array(
      $namespace,
      $shortname,
    );
  }
  return array(
    $default,
    $name,
  );
}