Controller::getRequestSegments

@return \O2System\Kernel\Http\Message\Uri\Segments
182813
public function getRequestSegments()
    {
        if (empty($this->requestSegments)) {
            $segments[] = $this->getParameter();

            if ( ! in_array($this->getRequestMethod(), ['index', 'route'])) {
                array_push($segments, $this->getRequestMethod());
            }

            $this->setRequestSegments($segments);
        }

        return $this->requestSegments;
    }
370626
public function getUriSegment($index)
    {
        $segments = explode('/', $this->server->get('REQUEST_URI'));
        if (isset($segments[$index])) {
            return $segments[$index];
        }
        return false;
    }
932360
public function segments()
	{
		$segments = explode('/', $this->path());

		return array_values(array_filter($segments, function ($v)
		{
			return $v != '';
		}));
	}
274717
public function addSegments($segments)
    {
        if ( ! $segments instanceof Segments) {
            $segments = new Segments($segments);
        }

        $currentSegments = $this->segments->getParts();
        $addSegments = $segments->getParts();

        $uri = clone $this;
        $uri->segments = new Segments(array_merge($currentSegments, $addSegments));

        return $uri;
    }
1095682
public function parse(&$segments)
    {
        $path = implode('/', $segments);
        $vars = array();

        $matches = array();
        if (preg_match('/(\d+)-([^\/]+)/', $path, $matches)) {
            $vars['alias'] = $matches[2];
            $path = str_replace($matches[0], $matches[1], $path);
            $segments = array_filter(explode('/', $path));
        }

        $path = implode('/', $segments);

        $matches = array();

        if (preg_match('/@(\w+)/', $path, $matches)) {
            $vars['oid'] = $matches[1];
            if (isset($matches[2])) {
                $vars['view'] = $matches[2];
            }
            $path = ltrim(str_replace($matches[0], '', $path), '/');
            $segments = array_filter(explode('/', $path));
        }

        $vars = array_merge($vars, parent::parse($segments));

        if (isset($vars['id']) && current($segments)) {
            $vars['alias'] = array_shift($segments);
        }

        return $vars;
    }
51337
public static function getFirstSegment($segments)
    {
        if (is_array($segments)) {
            $vars = $segments;
        } else {
            $vars = self::segmentUrl($segments);
        }

        return current($vars);
    }
240773
protected function getOriginationUrls() {
        if (!$this->_originationUrls) {
            $this->_originationUrls = new OriginationUrlList($this->version, $this->solution['sid']);
        }

        return $this->_originationUrls;
    }
472073
public static function getUrls()
    {
        $urls = [];

        foreach (static::$_crumbs as $crumb) {
            if (!empty($crumb['url'])) {
                $urls[] = $crumb['url'];
            } elseif (is_object($crumb)) {
                $urls[] = $crumb->url;
            }
        }

        return $urls;
    }
1120263
public function getUrlRule()
    {
        $request = $this->getRequestRoute();
        
        return [
            'module' => $this->module->id,
            'route' => $this->module->id . '/' . $request['route'],
            'params' => $request['originalArgs'],
        ];
    }
1107944
public function normalizePath()
    {
        if (!$this->path || $this->path == '/' || $this->path == '*') {
            return $this;
        }

        $results = array();
        $segments = $this->getPathSegments();
        foreach ($segments as $segment) {
            if ($segment == '..') {
                array_pop($results);
            } elseif ($segment != '.' && $segment != '') {
                $results[] = $segment;
            }
        }

        // Combine the normalized parts and add the leading slash if needed
        $this->path = ($this->path[0] == '/' ? '/' : '') . implode('/', $results);

        // Add the trailing slash if necessary
        if ($this->path != '/' && end($segments) == '') {
            $this->path .= '/';
        }

        return $this;
    }
936425
protected function parseCustomSegments(array $segments)
    {
        if (\count($segments) >= 2) {
            $group = "{$segments[0]}/{$segments[1]}";

            if ($this->getLoader()->exists($group)) {
                return [null, $group, \implode('.', \array_slice($segments, 2))];
            }
        }

        return $this->parseBasicSegments($segments);
    }
1008623
public static function segment($segment, $default = null)
	{
		if ($request = \Request::active())
		{
			return $request->uri->get_segment($segment, $default);
		}

		return null;
	}
1082425
public function parse(&$segments)
    {
        $query = array();
        $path = implode('/', $segments);
        if ($path == 'new') {
            array_pop($segments);
            $query = array_merge(parent::parse($segments), array('new' => true));
        } else {
            return parent::parse($segments);
        }

        return $query;
    }
657784
public function getResourcePath()
    {
        if (empty($this->resource)) {
            $path = request()->path();

            $segments = explode('/', $path);
            array_pop($segments);

            $this->resource = implode('/', $segments);
        }

        return $this->resource;
    }
71022
public function getUri()
    {
        $userPart = '';
        if ($this->getUser() !== null && $this->getPass() !== null) {
            $userPart = $this->getUser() . ':' . $this->getPass()  . '@';
        } else if ($this->getUser() !== null) {
            $userPart = $this->getUser() . '@';
        }
        $schemePart = ($this->getScheme() ? $this->getScheme() . '://' : '//');
        if (!in_array($this->getScheme(), self::getSchemesWithAuthority())) {
            $schemePart = $this->getScheme() . ':';
        }
        $portPart = ($this->getPort() ? ':' . $this->getPort() : '');
        $queryPart = ($this->getQuery() ? '?' . $this->getQuery() : '');
        $fragmentPart = ($this->getFragment() ? '#' . $this->getFragment() : '');
        if ($this->isRelative()) {
            return $this->getPath() .
            $queryPart .
            $fragmentPart;
        }
        $path = $this->getPath();
        if (0 !== strlen($path) && '/' !== $path[0]) {
            $path = '/' . $path;
        }
        return $schemePart .
        $userPart .
        $this->getHost() .
        $portPart .
        $path .
        $queryPart .
        $fragmentPart;
    }
456616
public function getParts()
    {
        $query = (string) $this->query;

        return array(
            'scheme' => $this->scheme,
            'user' => $this->username,
            'pass' => $this->password,
            'host' => $this->host,
            'port' => $this->port,
            'path' => $this->getPath(),
            'query' => $query !== '' ? $query : null,
            'fragment' => $this->fragment,
        );
    }
1769
protected function processSegments(array $segments)
    {
        $this->segments = [];

        foreach ($segments as $segment) {
            $this->segments[] = $segment->traverse($this);
        }

        return $this->segments;
    }