Exakat\Tasks\Load::getFullnspath PHP Method

getFullnspath() private method

private getFullnspath ( $nameId, $type = 'class' )
    private function getFullnspath($nameId, $type = 'class')
    {
        // Handle static, self, parent and PHP natives function
        if (isset($this->atoms[$nameId]['absolute']) && $this->atoms[$nameId]['absolute'] === true) {
            return strtolower($this->atoms[$nameId]['fullcode']);
        } elseif (!in_array($this->atoms[$nameId]['atom'], array('Nsname', 'Identifier', 'String'))) {
            // No fullnamespace for non literal namespaces
            return '';
        } elseif (in_array($this->atoms[$nameId]['token'], array('T_STATIC', 'T_ARRAY', 'T_EVAL', 'T_ISSET', 'T_EXIT', 'T_UNSET', 'T_ECHO', 'T_PRINT', 'T_LIST', 'T_EMPTY'))) {
            // For language structures, it is always in global space, like eval or list
            return '\\' . strtolower($this->atoms[$nameId]['code']);
        } elseif (strtolower(substr($this->atoms[$nameId]['fullcode'], 0, 9)) === 'namespace') {
            // namespace\A\B
            return substr($this->namespace, 0, -1) . strtolower(substr($this->atoms[$nameId]['fullcode'], 9));
        } elseif ($this->atoms[$nameId]['atom'] === 'Identifier') {
            // This is an identifier, self or parent
            if (strtolower($this->atoms[$nameId]['code']) === 'self' || strtolower($this->atoms[$nameId]['code']) === 'parent') {
                return '\\' . strtolower($this->atoms[$nameId]['code']);
                // This is an identifier
            } elseif ($type === 'class' && isset($this->uses['class'][strtolower($this->atoms[$nameId]['code'])])) {
                return $this->uses['class'][strtolower($this->atoms[$nameId]['code'])];
            } elseif ($type === 'const' && isset($this->uses['const'][strtolower($this->atoms[$nameId]['code'])])) {
                return $this->uses['const'][strtolower($this->atoms[$nameId]['code'])];
            } elseif ($type === 'function' && isset($this->uses['function'][strtolower($this->atoms[$nameId]['code'])])) {
                return $this->uses['function'][strtolower($this->atoms[$nameId]['code'])];
            } else {
                return $this->namespace . strtolower($this->atoms[$nameId]['fullcode']);
            }
        } elseif ($this->atoms[$nameId]['atom'] === 'String' && isset($this->atoms[$nameId]['noDelimiter'])) {
            if (empty($this->atoms[$nameId]['noDelimiter'])) {
                $prefix = '\\';
            } else {
                $prefix = ($this->atoms[$nameId]['noDelimiter'][0] === '\\' ? '' : '\\') . strtolower($this->atoms[$nameId]['noDelimiter']);
            }
            // define doesn't care about use...
            return $prefix;
        } else {
            // Finally, the case for a nsname
            $prefix = strtolower(substr($this->atoms[$nameId]['fullcode'], 0, strpos($this->atoms[$nameId]['fullcode'], '\\')));
            if (isset($this->uses[$type][$prefix])) {
                return $this->uses[$type][$prefix] . strtolower(substr($this->atoms[$nameId]['fullcode'], strlen($prefix)));
            } else {
                return $this->namespace . strtolower($this->atoms[$nameId]['fullcode']);
            }
        }
    }
Load