protected function handleInternal(PHPPreStack &$stack, PHPPreActionSet &$actionSet) { $willBeExecuted = true; if ($stack->top() instanceof AbstractPHPPreConditionalDirective) { $willBeExecuted = $stack->top()->getCondition(); } if ($willBeExecuted) { $this->showMessage($actionSet); } }
/** * @param PHPPreStack $stack * @param PHPPreActionSet $actionSet * @throws PHPPreParserException */ public function handleInternal(PHPPreStack &$stack, PHPPreActionSet &$actionSet) { if ($stack->top() instanceof AbstractPHPPreConditionalDirective) { $conditionalTag = $stack->pop(); if (!$conditionalTag->getCondition()) { $action = new PHPPreDeleteLinesAction(); $action->setStartLine($conditionalTag->getFileLine()); $action->setEndLine($this->getFileLine()); $actionSet->addAction($action); } } else { throw new PHPPreParserException('No opening tag found for endif', $this->getFileLine()); } }
/** * @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); }
/** * @param PHPPreStack $stack * @param PHPPreActionSet $actionSet */ public function handleInternal(PHPPreStack &$stack, PHPPreActionSet &$actionSet) { $this->condition = PhpPreTask::defineGet($this->argument) === null; $stack->push($this); }