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 ElseDirective) { throw new PHPPreParserException('This is second else tag in a row', $this->getFileLine()); } if ($stack->top() instanceof AbstractPHPPreConditionalDirective) { $conditionalTag = $stack->pop(); $stack->push($this); $this->condition = false; if (!$conditionalTag->getCondition()) { $this->condition = true; $action = new PHPPreDeleteLinesAction(); $action->setStartLine($conditionalTag->getFileLine()); $action->setEndLine($this->getFileLine()); $actionSet->addAction($action); } } else { throw new PHPPreParserException('No opening tag found for else', $this->getFileLine()); } }