Ejemplo n.º 1
0
 public function __construct($dictionaryName, File $file, $xmlLineNumber)
 {
     parent::__construct('Dictionary "' . $dictionaryName . '" not found in template: ' . $file->getFilename() . '(' . $xmlLineNumber . ')');
     $this->dictionaryName = $dictionaryName;
     $this->file = $file->getFilename();
     $this->line = $xmlLineNumber;
 }
Ejemplo n.º 2
0
 /**
  * @param $name
  * @return Dictionary
  */
 public function getDictionary($name)
 {
     // If there is no dictionary by that name in the dictionaries
     // attached to the current file,
     if (0 == count($this->dictionaries) || !array_key_exists($name, $this->dictionaries)) {
         //if this file is root file (no parent), error!
         if (null == $this->parentFile) {
             return null;
         }
         //otherwise, search the parent file's dictionaries for the dictionary with specified name.
         return $this->parentFile->getDictionary($name);
     }
     //This will throw an exception if the entry is not found
     //in the current file's named dictionary, instead of searching parent's hierarchy for
     //dictionaries with the same name.
     return $this->dictionaries[$name];
 }
Ejemplo n.º 3
0
 /**
  * @return Filter
  */
 private function instanciateFilter($className)
 {
     if (!class_exists($className)) {
         $classFile = $className . '.php';
         if (realpath($classFile) != $classFile) {
             $classFile = $this->view->getFilterPath() . '/' . $classFile;
         }
         if (!file_exists($classFile)) {
             $message = 'Filter file not found: ' . $classFile . ' in Fig source: ' . $this->currentFile->getFilename() . "({$this->xmlLineNumber})";
             throw new FileNotFoundException($message, $classFile);
         }
         require_once $classFile;
         //Check that the loaded file did declare the requested class:
         if (!class_exists($className)) {
             $message = "Undefined filter class: {$className} in file: {$classFile}";
             throw new RenderingException($this->getTagName(), $this->getCurrentFilename(), $this->getLineNumber(), $message);
         }
     }
     if ($this->view->getFilterFactory()) {
         return $this->view->getFilterFactory()->create($className);
     }
     $reflection = new \ReflectionClass($className);
     return $reflection->newInstance();
 }
Ejemplo n.º 4
0
 /**
  * @return string
  */
 public function getFilename()
 {
     return $this->file->getFilename();
 }