Lines Matching refs:name

139     public function getSource($name)  argument
143 return file_get_contents($this->findTemplate($name));
146 public function getSourceContext($name) argument
148 $path = $this->findTemplate($name);
150 return new Source(file_get_contents($path), $name, $path);
153 public function getCacheKey($name) argument
155 $path = $this->findTemplate($name);
164 public function exists($name) argument
166 $name = $this->normalizeName($name);
168 if (isset($this->cache[$name])) {
173 return false !== $this->findTemplate($name, false);
181 public function isFresh($name, $time) argument
183 return filemtime($this->findTemplate($name)) < $time;
186 protected function findTemplate($name) argument
189 $name = $this->normalizeName($name);
191 if (isset($this->cache[$name])) {
192 return $this->cache[$name];
195 if (isset($this->errorCache[$name])) {
200 throw new LoaderError($this->errorCache[$name]);
204 $this->validateName($name);
206 list($namespace, $shortname) = $this->parseName($name);
216 …$this->errorCache[$name] = sprintf('There are no registered paths for namespace "%s".', $namespace…
222 throw new LoaderError($this->errorCache[$name]);
232 return $this->cache[$name] = $realpath;
235 return $this->cache[$name] = $path.'/'.$shortname;
239 …$this->errorCache[$name] = sprintf('Unable to find template "%s" (looked into: %s).', $name, implo…
245 throw new LoaderError($this->errorCache[$name]);
248 protected function parseName($name, $default = self::MAIN_NAMESPACE) argument
250 if (isset($name[0]) && '@' == $name[0]) {
251 if (false === $pos = strpos($name, '/')) {
252 …sprintf('Malformed namespaced template name "%s" (expecting "@namespace/template_name").', $name));
255 $namespace = substr($name, 1, $pos - 1);
256 $shortname = substr($name, $pos + 1);
261 return [$default, $name];
264 protected function normalizeName($name) argument
266 return preg_replace('#/{2,}#', '/', str_replace('\\', '/', (string) $name));
269 protected function validateName($name) argument
271 if (false !== strpos($name, "\0")) {
275 $name = ltrim($name, '/');
276 $parts = explode('/', $name);
286 …rror(sprintf('Looks like you try to load a template outside configured directories (%s).', $name));