Returns the controller's data for an URI

@param string $uri URI
@param string $namespace URI namespace

@return array [string uri, string namespace, array defaults]
548374
private static function _getController($uri, $namespace) {
        $dir = realpath(APP_PATH . '/../' . $namespace) . DIRECTORY_SEPARATOR;

        if (!is_dir($dir . $uri)) {
            $uriParts = explode('/', $uri, 2);
            if (is_dir($dir . $uriParts[0])) {
                return self::_getController($uriParts[1], $namespace . $uriParts[0] . '\\');
            } elseif (is_file($dir . $uriParts[0] . '.php')) {
                $uri = $uriParts[0];
            }
        } else {
            $namespace = $namespace . '\\' . str_replace('/', '\\', $uri);
            $uri = '';
        }

        if (substr($namespace, -1) == '\\') {
            $namespace = substr($namespace, 0, strlen($namespace) - 1);
        }
        if (!$uri) {
            $uri = self::getNamespaceDefaultClass($namespace, 'App\\'); // Sets the default class
        }

        return self::fixNamespace($namespace . '\\' . $uri);
    }
282848
private static function postData(string $uri, array $data): array
    {
        self::initialize();

        $response = self::$client->post('api/' . self::$version . '/' . $uri, [
            'form_params' => $data,
        ]);

        return json_decode($response->getBody(), TRUE);
    }
169556
public function getNamespaceAttribute($namespace_uri, $local_name)
    {
        $attrs = $this->namespaces_by_uri[$namespace_uri]->getAttributes();
        return $attrs[$local_name];
    }
1161770
private function getParameters($namespace)
    {
        $parameters = [];

        /** @var Parameter $parameter */
        foreach ($this->parameterRepository->findBy(['namespace' => $namespace]) as $parameter) {
            $parameters[$parameter->getName()] = $parameter->getValue();
        }

        return $parameters;
    }
107568
public function getNamespaceURI()
	{
		if ( is_null( $this->domNode ) ) return null;
		return is_null( $this->domNode->namespaceURI ) ? "" : $this->domNode->namespaceURI;
	}
612394
public static function parseUri(string $uri){
        if(1 !== preg_match(static::REGEX_URI, $uri, $m)){
            return false;
        }

        $result = [
            "scheme"    => $m["scheme"] ?? "",
            "userinfo"  => $m["userinfo"] ?? "",
            "host"      => $m["host"] ?? "",
            "port"      => "" === $m["port"] ? null : (int)$m["port"],
            "path"      => $m["path"] ?? "",
            "query"     => $m["query"] ?? "",
            "fragment"  => $m["fragment"] ?? "",
        ];

        return $result;
    }
592680
private static function getResponse(string $uri, array $params = []): array
    {
        self::initialize();

        if (empty($params)) {
            $response = self::$client->get('api/' . self::$version . '/' . $uri);
        } else {
            $response = self::$client->post('api/' . self::$version . '/' . $uri, [
                'form_params' => $params,
            ]);
        }

        return json_decode($response->getBody(), TRUE);
    }
587369
public function getResource(
        $uri = "",
        $headers = []
    ) {
        // Set headers
        $options = ['http_errors' => false, 'headers' => $headers];

        // Send the request.
        return $this->client->request(
            'GET',
            $uri,
            $options
        );
    }
531787
public function getData($namespace = null)
    {
        if(!self::$pluginData) {
            // try to find the model via namespace
            if (!$namespace) {
                // if we are in a model
                if (property_exists($this, 'namespace')) {
                    self::$pluginData = $this;
                } /// When calling the method from a parent class that uses this class as a parent
                else {
                    // try to find plugin's model via reflection class
                    try{
                        $reflector = new \ReflectionClass(self::class);
                        $fn = $reflector->getFileName();
                        $explode = explode('plugins/', str_replace('\\', '/', dirname($fn)));
                        if (isset($explode[1])) {
                            $pluginNamespace = str_replace('/Controllers', '', $explode[1]);
                            self::$pluginData = Plugin::where('namespace', $pluginNamespace)->first();
                        }

                    }catch(\Exception $e){
                        return null;
                    }
                }
            }else {
                // Return a requested plugin
                self::$pluginData = $this->getByNamespace($namespace);
            }
        }

        if (!self::$pluginData) {
            return null;
        }

        return self::$pluginData;
    }
877949
public function get($uri, $parameters = array())
    {
        return $this->request(self::METHOD_GET, $this->getUrl($uri), $parameters);
    }
138774
public function getValue($name, $namespace = self::DEFAULT_NAMESPACE)
    {
        return isset($this->values[$namespace][$name]) ? $this->values[$namespace][$name] : null;
    }
65765
private function getUriParameters($uri)
    {
        $params = [];
        $pattern = '/\{([^\/]+)\}/';
        if (preg_match_all($pattern, $uri, $results) > 0) {
            foreach ($results[1] as $result) {
                $params[] = $result;
            }
        }
        return $params;
    }
1331740
public function get($namespace, $index)
    {
        if (!isset($this->storage[$namespace][$index])) {
            return null;
        }

        return $this->storage[$namespace][$index];
    }
197607
protected function getRouteInformation(Route $route, $filter, $namespace): ?array
    {
        $uri = $route->uri();
        $host = $route->domain();
        $name = $route->getName();
        $laroute = $route->getAction('laroute');

        switch ($filter) {
            case 'all':
                if ($laroute === false) {
                    return null;
                }
                break;
            case 'only':
                if ($laroute !== true) {
                    return null;
                }
                break;
        }

        return compact('host', 'uri', 'name');
    }
899669
protected function parseUrl($uri)
    {
        $parsedUrl = parse_url($uri);

        return [
            isset($parsedUrl['scheme']) ? $parsedUrl['scheme'] : '',
            isset($parsedUrl['host']) ? $parsedUrl['host'] : '',
            isset($parsedUrl['port']) ? $parsedUrl['port'] : null,
            isset($parsedUrl['path']) ? $parsedUrl['path'] : '/',
            isset($parsedUrl['query']) ? $parsedUrl['query'] : '',
            isset($parsedUrl['fragment']) ? $parsedUrl['fragment'] : '',
            isset($parsedUrl['user']) ? $parsedUrl['user'] : '',
            isset($parsedUrl['pass']) ? $parsedUrl['pass'] : ''
        ];
    }
1320217
public function get($uri)
    {
        $options = array(
            CURLOPT_URL => $this->domain.'/'.ltrim($uri, '/'),
            CURLOPT_FOLLOWLOCATION => 1,
            CURLOPT_RETURNTRANSFER => 1,
        );

        return $this->exec($options);
    }
902406
protected static function _namespaceGetAll($namespace)
    {
        $currentData  = (isset($_SESSION[$namespace]) && is_array($_SESSION[$namespace])) ?
            $_SESSION[$namespace] : array();
        $expiringData = (isset(self::$_expiringData[$namespace]) && is_array(self::$_expiringData[$namespace])) ?
            self::$_expiringData[$namespace] : array();
        return array_merge($currentData, $expiringData);
    }