You are here

protected function Twig_Loader_Filesystem::parseName in Translation template extractor 6.3

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

File

vendor/Twig/Loader/Filesystem.php, line 194

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,
  );
}