Exakat\Tasks\Load::processNamespace PHP Method

processNamespace() private method

private processNamespace ( )
    private function processNamespace()
    {
        $current = $this->id;
        if ($this->tokens[$this->id + 1][0] === T_OPEN_CURLY) {
            $nameId = $this->addAtomVoid();
        } elseif ($this->tokens[$this->id + 1][0] === T_NS_SEPARATOR) {
            --$this->id;
            $nsnameId = $this->processOneNsname();
            $this->setAtom($nsnameId, array('fullnspath' => $this->getFullnspath($nsnameId)));
            $this->pushExpression($nsnameId);
            return $this->processFCOA($nsnameId);
        } else {
            $nameId = $this->processOneNsname();
        }
        $namespaceId = $this->addAtom('Namespace');
        $this->addLink($namespaceId, $nameId, 'NAME');
        $this->setNamespace($nameId);
        // Here, we make sure namespace is encompassing the next elements.
        if ($this->tokens[$this->id + 1][0] === T_SEMICOLON) {
            // Process block
            ++$this->id;
            // Skip ; to start actual sequence
            if ($this->tokens[$this->id + 1][0] === T_END) {
                $voidId = $this->addAtomVoid();
                $blockId = $this->addAtom('Sequence');
                $this->setAtom($blockId, array('code' => '{}', 'fullcode' => self::FULLCODE_BLOCK, 'line' => $this->tokens[$this->id][2], 'token' => $this->getToken($this->tokens[$this->id][0]), 'bracket' => false));
                $this->addLink($blockId, $voidId, 'ELEMENT');
            } else {
                $blockId = $this->processNamespaceBlock();
            }
            $this->addLink($namespaceId, $blockId, 'BLOCK');
            $this->addToSequence($namespaceId);
            $block = ';';
        } else {
            // Process block
            $blockId = $this->processFollowingBlock(false);
            $this->popExpression();
            $this->addLink($namespaceId, $blockId, 'BLOCK');
            $this->pushExpression($namespaceId);
            $this->processSemicolon();
            $block = self::FULLCODE_BLOCK;
        }
        $this->setNamespace(0);
        $x = array('code' => $this->tokens[$current][1], 'fullcode' => $this->tokens[$current][1] . ' ' . $this->atoms[$nameId]['fullcode'] . $block, 'line' => $this->tokens[$current][2], 'token' => $this->getToken($this->tokens[$current][0]), 'fullnspath' => $this->atoms[$nameId]['fullnspath']);
        $this->setAtom($namespaceId, $x);
        return $namespaceId;
    }
Load