Exakat\Tasks\Load::processTry PHP Method

processTry() private method

private processTry ( )
    private function processTry()
    {
        $current = $this->id;
        $tryId = $this->addAtom('Try');
        $blockId = $this->processFollowingBlock(array(T_CLOSE_CURLY));
        $this->popExpression();
        $this->addLink($tryId, $blockId, 'BLOCK');
        $rank = 0;
        $fullcodeCatch = array();
        while ($this->tokens[$this->id + 1][0] === T_CATCH) {
            $catch = $this->id + 1;
            ++$this->id;
            // Skip catch
            ++$this->id;
            // Skip (
            $catchId = $this->addAtom('Catch');
            $catchFullcode = array();
            $rankCatch = -1;
            while ($this->tokens[$this->id + 1][0] !== T_VARIABLE) {
                $classId = $this->processOneNsname();
                $this->setAtom($catchId, array('rank' => ++$rankCatch));
                $this->addLink($catchId, $classId, 'CLASS');
                $this->addCall('class', $this->getFullnspath($classId), $classId);
                $catchFullcode[] = $this->atoms[$classId]['fullcode'];
                if ($this->tokens[$this->id + 1][0] === T_PIPE) {
                    ++$this->id;
                    // Skip |
                }
            }
            $this->setAtom($catchId, array('count' => $rankCatch + 1));
            $catchFullcode = implode(' | ', $catchFullcode);
            // Process variable
            $this->processNext();
            $variableId = $this->popExpression();
            $this->addLink($catchId, $variableId, 'VARIABLE');
            // Skip )
            ++$this->id;
            // Skip }
            $blockCatchId = $this->processFollowingBlock(array(T_CLOSE_CURLY));
            $this->popExpression();
            $this->addLink($catchId, $blockCatchId, 'BLOCK');
            $this->setAtom($catchId, array('code' => $this->tokens[$catch][1], 'fullcode' => $this->tokens[$catch][1] . ' (' . $catchFullcode . ' ' . $this->atoms[$variableId]['fullcode'] . ')' . static::FULLCODE_BLOCK, 'line' => $this->tokens[$catch][2], 'token' => $this->getToken($this->tokens[$current][0]), 'rank' => ++$rank));
            $this->addLink($tryId, $catchId, 'CATCH');
            $fullcodeCatch[] = $this->atoms[$catchId]['fullcode'];
        }
        if ($this->tokens[$this->id + 1][0] === T_FINALLY) {
            $finally = $this->id + 1;
            $finallyId = $this->addAtom('Finally');
            ++$this->id;
            $finallyBlockId = $this->processFollowingBlock(false);
            $this->popExpression();
            $this->addLink($tryId, $finallyId, 'FINALLY');
            $this->addLink($finallyId, $finallyBlockId, 'BLOCK');
            $this->setAtom($finallyId, array('code' => $this->tokens[$finally][1], 'fullcode' => $this->tokens[$finally][1] . static::FULLCODE_BLOCK, 'line' => $this->tokens[$finally][2], 'token' => $this->getToken($this->tokens[$current][0])));
        }
        $this->setAtom($tryId, array('code' => $this->tokens[$current][1], 'fullcode' => $this->tokens[$current][1] . static::FULLCODE_BLOCK . implode('', $fullcodeCatch) . (isset($finallyId) ? $this->atoms[$finallyId]['fullcode'] : ''), 'line' => $this->tokens[$current][2], 'token' => $this->getToken($this->tokens[$current][0]), 'count' => $rank));
        $this->pushExpression($tryId);
        $this->processSemicolon();
        return $tryId;
    }
Load