/** * @return PHPPreDirectiveFactory */ public static function getInstance() { if (empty(self::$instance)) { self::$instance = new PHPPreDirectiveFactory(); } return self::$instance; }
/** * @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; }