Exakat\Tasks\Load::processClass PHP Method

processClass() private method

private processClass ( )
    private function processClass()
    {
        $current = $this->id;
        $classId = $this->addAtom('Class');
        $this->currentClassTrait[] = $classId;
        $this->toggleContext(self::CONTEXT_CLASS);
        // Should work on Abstract and Final only
        $fullcode = array();
        foreach ($this->optionsTokens as $name => $optionId) {
            $this->addLink($classId, $optionId, strtoupper($name));
            $fullcode[] = $this->atoms[$optionId]['fullcode'];
        }
        $this->optionsTokens = array();
        if ($this->tokens[$this->id + 1][0] === T_STRING) {
            $nameId = $this->processNextAsIdentifier();
        } else {
            $nameId = $this->addAtomVoid();
            if ($this->tokens[$this->id + 1][0] === T_OPEN_PARENTHESIS) {
                // Process arguments
                ++$this->id;
                // Skip arguments
                $argumentsId = $this->processArguments();
                $this->addLink($classId, $argumentsId, 'ARGUMENTS');
            }
        }
        $this->addLink($classId, $nameId, 'NAME');
        // Process extends
        if ($this->tokens[$this->id + 1][0] === T_EXTENDS) {
            $extends = $this->tokens[$this->id + 1][1];
            ++$this->id;
            // Skip extends
            $extendsId = $this->processOneNsname();
            $this->addLink($classId, $extendsId, 'EXTENDS');
            $this->addCall('class', $this->getFullnspath($extendsId), $extendsId);
        }
        // Process implements
        if ($this->tokens[$this->id + 1][0] === T_IMPLEMENTS) {
            $implements = $this->tokens[$this->id + 1][1];
            $fullcodeImplements = array();
            do {
                ++$this->id;
                // Skip implements
                $implementsId = $this->processOneNsname();
                $this->addLink($classId, $implementsId, 'IMPLEMENTS');
                $fullcodeImplements[] = $this->atoms[$implementsId]['fullcode'];
                $this->addCall('class', $this->getFullnspath($implementsId), $implementsId);
            } while ($this->tokens[$this->id + 1][0] === T_COMMA);
        }
        // Process block
        ++$this->id;
        $blockId = $this->processBlock(false);
        $this->popExpression();
        $this->addLink($classId, $blockId, 'BLOCK');
        $fullnspath = $this->getFullnspath($nameId);
        $this->setAtom($classId, array('code' => $this->tokens[$current][1], 'fullcode' => (!empty($fullcode) ? implode(' ', $fullcode) . ' ' : '') . $this->tokens[$current][1] . ($this->atoms[$nameId]['atom'] === 'Void' ? '' : ' ' . $this->atoms[$nameId]['fullcode']) . (isset($argumentsId) ? ' (' . $this->atoms[$argumentsId]['fullcode'] . ')' : '') . (isset($extendsId) ? ' ' . $extends . ' ' . $this->atoms[$extendsId]['fullcode'] : '') . (isset($implementsId) ? ' ' . $implements . ' ' . implode(', ', $fullcodeImplements) : '') . static::FULLCODE_BLOCK, 'line' => $this->tokens[$current][2], 'token' => $this->getToken($this->tokens[$current][0]), 'fullnspath' => $fullnspath));
        $this->pushExpression($classId);
        $this->addDefinition('class', $fullnspath, $classId);
        // Case of anonymous classes
        if ($this->tokens[$current - 1][0] !== T_NEW) {
            $this->processSemicolon();
        }
        $this->toggleContext(self::CONTEXT_CLASS);
        array_pop($this->currentClassTrait);
        return $classId;
    }
Load