コード例 #1
0
 /**
  * @return PHPPreOperatorFactory
  */
 public static function getInstance()
 {
     if (empty(self::$instance)) {
         self::$instance = new PHPPreOperatorFactory();
     }
     return self::$instance;
 }
コード例 #2
0
 /**
  * @param PHPPreStack $stack
  * @param PHPPreActionSet $actionSet
  * @throws PHPPreParserException
  */
 public function handleInternal(PHPPreStack &$stack, PHPPreActionSet &$actionSet)
 {
     $arguments = preg_split('/[\\s]/', $this->argument);
     $define = PhpPreTask::defineGet($arguments[0]);
     $leftOperator = PHPPreOperatorFactory::createValueOperator($define);
     $rightOperator = PHPPreOperatorFactory::createValueOperator($arguments[2]);
     try {
         $operator = PHPPreOperatorFactory::createBinaryOperator($arguments[1], $leftOperator, $rightOperator);
     } catch (Exception $ex) {
         throw new PHPPreParserException($ex->getMessage(), $this->getFileLine());
     }
     $this->condition = $operator->getValue();
     $stack->push($this);
 }