/**
  * @return PHPPreDirectiveFactory
  */
 public static function getInstance()
 {
     if (empty(self::$instance)) {
         self::$instance = new PHPPreDirectiveFactory();
     }
     return self::$instance;
 }
예제 #2
0
 /**
  * @param $definitions
  * @return mixed
  */
 public function parse(&$definitions)
 {
     $lineNumber = 0;
     $actionSet = new PHPPreActionSet($this->outputMode);
     foreach ($this->fileLines as $line) {
         if (preg_match('/^[\\s]*#.*/', $line)) {
             $line = trim($line);
             $parsedLine = $this->splitPreprocessorLine($line);
             $tag = PHPPreDirectiveFactory::getInstance()->createTag($parsedLine[0], $parsedLine[1], $lineNumber, $definitions);
             $tag->handle($this->stack, $actionSet);
         }
         $lineNumber++;
     }
     $actionSet->executeActions($this->fileLines);
     return $this->fileLines;
 }