/** * {@inheritdoc} * * @throws TemplaterException */ public function __construct(Templater $templater, array $token) { $attributes = $token[HtmlTokenizer::TOKEN_ATTRIBUTES]; if (!$templater instanceof TemplateProcessor) { throw new TemplaterException("NamespaceImport must be executed using TemplateProcessor."); } if (strpos($attributes['path'], $templater->getOptions()['nsSeparator']) !== false) { //Path includes namespace, we can fetch it regular way list($this->namespace, $this->directory) = $templater->fetchLocation($attributes['path'], $token); } else { $this->namespace = $templater->getCompiler()->getNamespace(); $this->directory = $attributes['path']; } $this->directory = rtrim($this->directory, '/*'); $this->outerNamespace = $attributes['namespace']; //Let's generate set of aliases $this->buildAliases($templater->getViews(), $templater, $token); }
/** * {@inheritdoc} */ public function __construct(Templater $templater, array $token) { $attributes = $token[HtmlTokenizer::TOKEN_ATTRIBUTES]; $this->location = $templater->fetchLocation($attributes['path'], $token); $this->alias = $attributes['as']; }