Exakat\Tasks\Load::processTernary PHP Method

processTernary() private method

private processTernary ( )
    private function processTernary()
    {
        $current = $this->id;
        $conditionId = $this->popExpression();
        $ternaryId = $this->addAtom('Ternary');
        while (!in_array($this->tokens[$this->id + 1][0], array(T_COLON))) {
            $this->processNext();
        }
        $thenId = $this->popExpression();
        ++$this->id;
        // Skip colon
        $finals = $this->precedence->get($this->tokens[$this->id][0]);
        $finals[] = T_COLON;
        // Added from nested Ternary
        $finals[] = T_CLOSE_TAG;
        $this->nestContext();
        do {
            $this->processNext();
        } while (!in_array($this->tokens[$this->id + 1][0], $finals));
        $this->exitContext();
        $elseId = $this->popExpression();
        $this->addLink($ternaryId, $conditionId, 'CONDITION');
        $this->addLink($ternaryId, $thenId, 'THEN');
        $this->addLink($ternaryId, $elseId, 'ELSE');
        $x = array('code' => '?', 'fullcode' => $this->atoms[$conditionId]['fullcode'] . ' ?' . ($this->atoms[$thenId]['atom'] === 'Void' ? '' : ' ' . $this->atoms[$thenId]['fullcode'] . ' ') . ': ' . $this->atoms[$elseId]['fullcode'], 'line' => $this->tokens[$current][2], 'token' => 'T_QUESTION');
        $this->setAtom($ternaryId, $x);
        $this->pushExpression($ternaryId);
        if (!$this->isContext(self::CONTEXT_NOSEQUENCE) && $this->tokens[$this->id + 1][0] === T_CLOSE_TAG) {
            $this->processSemicolon();
        }
        return $ternaryId;
    }
Load