Retorna la especificacion del controlador que mapea con la URI actual
Levanta error 404 si ningun controlador mapea
@param string $uriapp
@return array
168527
public function mappingController($uriapp = NULL, $method = NULL){
        $controllers= $this->app->context->getControllersDefinition();
        $maps= FALSE;
        //Recorre todos los controladores principales hasta que uno coincida con la URI actual
        foreach ($controllers as $url => $controller_esp) {            
            //Analiza si el controlador mapea con la uri actual
            $controller_esp['url']= strpos($url, '@') ? substr($url, 0, strpos($url, '@')) : $url;
            
            $mapController= $this->mapsController($controller_esp, $uriapp, $method);
            if($mapController == NULL && isset($controller_esp['routes'])){
                foreach ($controller_esp['routes'] as $url => $controller_esp_2) {
                    $controller_esp_2['url']= strpos($url, '@') ? substr($url, 0, strpos($url, '@')) : $url;
                    $mapController= $this->mapsController($controller_esp_2, $uriapp, $method, $controller_esp);
                    if($mapController != NULL){
                        break;
                    }
                }
            }
            if($mapController != NULL){
                return $mapController;
            }           
        }
        //si ningun controlador mapeo avisa el problema
        if(! $maps){
            Error::error_404();
        }
    }
93877
public function getPageUrl($page, $uriType = Router::ABSOLUTE_PATH)
    {
        if ($page > $this->getPagesCount()) {
            throw new \BadMethodCallException('The page requested does not exist');
        }

        if ( ! ($this->getPath())) {
            throw new \Exception('The path is empty, either set it with a parse request or with a getter method');
        }

        $queryParams = $this->getQuery();
        $queryParams['page'] = $page;

        return $this->router
            ->generate($this->getPath(), $queryParams, $uriType);
    }
534829
public function getReportInputControls($uri)
    {
        $url = $this->service_url . '/reports' . $uri . '/inputControls/values';
        $data = $this->service->prepAndSend($url, array(200, 204), 'GET', null, true, 'application/json', 'application/json');

        $result = array();
        $json_obj = json_decode($data);

        // JRS returns an OK status code with an error message string as the body... so if we cannot parse it into an
        // array, we know that there was an error
        if (empty($json_obj)) {
            return $result;
        }

        foreach ($json_obj->inputControlState as $state) {
            $result[] = \Jaspersoft\Dto\Report\InputControl::createFromJSON($state);
        }
        return $result;
	}
808363
public function buildUriWithQuery($uri, array $params = [])
    {
        $uri = uri_for($uri);

        if (!Uri::isAbsolute($uri)) {
            $uri = $uri->withScheme($this->baseURL->getScheme())
                ->withUserInfo($this->baseURL->getUserInfo())
                ->withHost($this->baseURL->getHost())
                ->withPort($this->baseURL->getPort());
        }

        $default = [
            'username' => $this->username,
            'password' => $this->password,
        ];

        return $uri->withQuery(build_query(array_merge($default, $params)));
    }
21028
public function getPagedResults($limit = 50, $page = 0)
    {
        $dql = sprintf(self::DQL_GET_VCSS, VersionControlProvider::class);

        return $this->getPaginator($dql, $limit, $page);
    }
1374030
private function getArguments(string $uri, string $routeUri): ?array
    {
        if (preg_match_all('/({[a-z]+:)/i', $routeUri, $matches)) {
            $regex = str_replace('/', '\/',
                str_replace('}', ')',
                    preg_replace('/{([a-z]+):/i', '(?<$1>', $routeUri)
                )
            );

            return $this->matchUri($regex, $uri);
        }

        return null;
    }
1103368
protected function find($uri)
    {
        /**
         * @var Route $route
         */
        foreach ($this->routes() as $key => $route)
        {
            if ($route->test($uri, $this->method))
            {
                return $route;
            }
        }

        throw new Exceptions\NotFound('Page `' . $uri . '` not found', 404);
    }
1326655
private function findRoute(string $uri, string $method): RouteInterface
    {
        $matches = [];
        $route = new NullRoute();

        foreach ($this->routes as $value) {
            $urlMatch = \preg_match('`^'.\preg_replace($this->matchTypes, $this->types, $value->url).'/?$`', $uri, $matches);
            $methodMatch = \strpos($value->method, $method);

            if ($urlMatch && $methodMatch !== false) {
                $route = clone $value;
                $this->routeMatches = $matches;
                break;
            }
        }

        return $route;
    }
65765
private function getUriParameters($uri)
    {
        $params = [];
        $pattern = '/\{([^\/]+)\}/';
        if (preg_match_all($pattern, $uri, $results) > 0) {
            foreach ($results[1] as $result) {
                $params[] = $result;
            }
        }
        return $params;
    }
1029464
public function match($uri, $method = 'GET')
    {
        $matches = [];

        if ($this->_method !== null && $this->_method !== $method && $this->_method !== 'REST') {
            return false;
        }

        if ($this->_compiledPattern[0] !== '#') {
            if ($this->_compiledPattern === $uri) {
                return $this->_paths;
            } else {
                return false;
            }
        } else {
            $r = preg_match($this->_compiledPattern, $uri, $matches);
            if ($r === false) {
                throw new InvalidFormatException([
                    '`:compiled` pcre pattern is invalid for `:pattern`',
                    'compiled' => $this->_compiledPattern,
                    'pattern' => $this->_pattern
                ]);
            } elseif ($r === 1) {
                $parts = $this->_paths;

                foreach ($matches as $k => $v) {
                    if (is_string($k)) {
                        $parts[$k] = $v;
                    }
                }

                if ($this->_method === 'REST') {
                    if (isset($matches['params'])) {
                        $methodAction = ['GET' => 'detail', 'POST' => 'update', 'PUT' => 'update', 'DELETE' => 'delete'];
                    } else {
                        $methodAction = ['GET' => 'index', 'POST' => 'create'];
                    }
                    if (isset($methodAction[$method])) {
                        $parts['action'] = $methodAction[$method];
                    } else {
                        return false;
                    }
                }
            } else {
                return false;
            }
        }

        if (isset($parts['controller']) && $parts['controller'] === '') {
            unset($parts['controller']);
        }

        if (isset($parts['action']) && $parts['action'] === '') {
            unset($parts['action']);
        }

        $r = [];
        $r['controller'] = isset($parts['controller']) ? $parts['controller'] : 'index';
        if (isset($parts['area'])) {
            $r['area'] = $parts['area'];
        }

        $r['action'] = isset($parts['action']) ? $parts['action'] : 'index';
        $params = isset($parts['params']) ? $parts['params'] : '';

        unset($parts['area'], $parts['controller'], $parts['action'], $parts['params']);
        if ($params) {
            $parts[0] = $params;
        }
        $r['params'] = $parts;

        return $r;
    }
803723
protected function postMap(): array
    {
        $auth = $this->core->auth();
        $paths = [];
        if ($auth->details === false) {
            $paths = array_merge($paths, [
                ['POST', '/login', "Auth@handleLogin"],
                ['POST', '/register', "Auth@handleRegister"],
                ['POST', '/forgot', "Auth@handleForgot"],
                ['POST', '/reset/[a:reset_code]', "Auth@handleReset"]
            ]);
        } else {
            $paths = array_merge($paths, [
                ['POST', '/login', "Auth@redirect"],
                ['POST', '/register', "Auth@redirect"],
                ['POST', '/forgot', "Auth@redirect"],
                ['POST', '/reset/[a:reset_code]', "Auth@redirect"]
            ]);
        }
        if ($auth->allow(["min" => 5, "max" => 1]) === true) {
            $paths = array_merge($paths, [
                ['POST', '/', "User@handleProfile"]
            ]);
        } elseif ($auth->details === false) {
            $paths = array_merge($paths, [
                ['POST', '/', "Home@redirect"]
            ]);
        }
        if ($auth->allow(["min" => 4, "max" => 4]) === true) {
            $paths = array_merge($paths, [
                ['POST', '/users/delete/[i:id]', "User@handleDelete"],
            ]);
        } elseif ($auth->details === false) {
            $paths = array_merge($paths, [
                ['POST', '/users/delete/[i:id]', "Home@redirect"]
            ]);
        }
        if ($auth->allow(["min" => 3, "max" => 1]) === true) {
            $paths = array_merge($paths, [
                ['POST', '/pages/new', "Page@handleNew"],
                ['POST', '/pages/edit/[i:id]', "Page@handleEdit"],
                ['POST', '/pages/delete/[i:id]', "Page@handleDelete"]
            ]);
        } elseif ($auth->details === false) {
            $paths = array_merge($paths, [
                ['POST', '/pages/new', "Home@redirect"],
                ['POST', '/pages/edit/[i:id]', "Home@redirect"],
                ['POST', '/pages/delete/[i:id]', "Home@redirect"]
            ]);
        }
        if ($auth->allow(["min" => 2, "max" => 1]) === true) {
            $paths = array_merge($paths, [
                ['POST', '/navigations/new', "Navigation@handleNew"],
                ['POST', '/navigations/edit/[i:id]', "Navigation@handleEdit"],
                ['POST', '/navigations/delete/[i:id]', "Navigation@handleDelete"]
            ]);
        } elseif ($auth->details === false) {
            $paths = array_merge($paths, [
                ['POST', '/navigations/new', "Home@redirect"],
                ['POST', '/navigations/edit/[i:id]', "Home@redirect"],
                ['POST', '/navigations/delete/[i:id]', "Home@redirect"]
            ]);
        }
        if ($auth->allow(["min" => 1, "max" => 1]) === true) {
            $paths = array_merge($paths, [
                ['POST', '/users/new', "User@handleNew"],
                ['POST', '/users/edit/[i:id]', "User@handleEdit"],
                ['POST', '/users/delete/[i:id]', "User@handleDelete"],
                ['POST', '/users/invalidate/[i:id]', "User@handleInvalidate"],
                ['POST', '/settings', "Site@handleSettings"]
            ]);
        } elseif ($auth->details === false) {
            $paths = array_merge($paths, [
                ['POST', '/users/new', "Home@redirect"],
                ['POST', '/users/edit/[i:id]', "Home@redirect"],
                ['POST', '/users/delete/[i:id]', "Home@redirect"],
                ['POST', '/users/invalidate/[i:id]', "Home@redirect"],
                ['POST', '/settings', "Home@redirect"]
            ]);
        }
        return $paths;
    }
1344805
public static function run($app)
    {
        $route = Router::process(new Request);

        // Route to 404 if controller and/or method cannot be found
        if (!class_exists($route['controller'])
        or !method_exists($route['controller'], "{$route['method']}Action")) {
            if ($app->environment() == 'development') {
                throw new Exception("Unable to find controller for '" . Request::pathInfo() . "'");
            } else {
                $route = Router::set404();
            }
        }

        // Get method parameters
        $r = new ReflectionMethod("{$route['controller']}::{$route['method']}Action");
        $params = [];

        foreach ($r->getParameters() as $param) {
            if (isset($route['params'][$param->getName()])) {
                $params[] = $route['params'][$param->getName()];
            }
        }
        unset($r, $param);

        static::$controller = new $route['controller']();

        // Run before filters
        $beforeAll    = EventDispatcher::dispatch("before." . $route['controller'] . "::*");
        $beforeAction = EventDispatcher::dispatch("before." . $route['controller'] . "::{$route['method']}");

        if ($beforeAll instanceof Response || $beforeAction instanceof Response) {
            static::$controller->executeAction = false;
            $response = $beforeAll ?: $beforeAction;
        }

        // Execute action
        if (static::$controller->executeAction) {
            $response = call_user_func_array(
                array(static::$controller, $route['method'] . 'Action'),
                $params
            );
        }

        // Run after filters
        $afterAll    = EventDispatcher::dispatch("after." . $route['controller'] . "::*");
        $afterAction = EventDispatcher::dispatch("after." . $route['controller'] . "::{$route['method']}");

        if ($afterAll instanceof Response || $afterAction instanceof Response) {
            $response = $afterAll instanceof Response ? $afterAll : $afterAction;
        }

        // Send response
        if (!$response instanceof Response) {
            throw new Exception("The controller [{$route['controller']}::{$route['method']}] returned an invalid response.");
        } else {
            $response->send();
        }

        // Shutdown the controller
        static::$controller->__shutdown();
    }
164363
public function map($uri, $method)
    {
        if ($uri === '/') {
            $uri = '';
        }

        $controller = $this;

        return $this->app->map(
            $this->baseUri.$uri,
            function () use ($controller, $method) {
                $params = func_get_args();
                $i = 0;
                $a = preg_replace_callback('/:(\w+)/', function($matches) use ($controller, $params, &$i) {
                    $value = @$params[$i++];
                    $controller->routeData($matches[1], $value);
                    return $value;
                }, $controller->baseUri);
                $controller->delegate($method, array_slice($params, $i));
            }
        );
    }
959652
public function getApiApps($page = 1, $page_size = 20)
    {
        $response = $this->rest->get(static::APIAPP_LIST_PATH, array('page' => $page, 'page_size' => $page_size));

        $this->checkResponse($response);

        $list = new ApiAppList($response);

        if ($page > $list->getNumPages()) {
            throw new Error('page_not_found', 'Page not found');
        }

        return $list;
    }
739574
public function updateInputControlValues($uri, array $parameters)
    {
        $url = $this->service_url . '/reports' . $uri . '/inputControls/' . join(';', array_keys($parameters)) . '/values';
        $response = $this->service->prepAndSend($url, array(200), 'POST', json_encode($parameters), true);

        $json_obj = json_decode($response);
        $result = array();
        foreach ($json_obj->inputControlState as $state) {
            $result[] = InputControlState::createFromJSON($state);
        }
        return $result;
    }
958741
protected function extractOptionalParameters($uri)
    {
        preg_match_all('/\{(\w+?)\?\}/', $uri, $matches);

        return isset($matches[1]) ? array_fill_keys($matches[1], null) : array();
    }
330222
protected function getIpAccessControlListMappings() {
        if (!$this->_ipAccessControlListMappings) {
            $this->_ipAccessControlListMappings = new AuthCallsIpAccessControlListMappingList(
                $this->version,
                $this->solution['accountSid'],
                $this->solution['domainSid']
            );
        }

        return $this->_ipAccessControlListMappings;
    }