Resolves route for requested action

@return Route? If route cannot be resolved, NULL is returned
334942
public function resolveRoute(): ?Route
    {
        $query = strtolower(rtrim($this->request->query->get('route'), '/'));

        switch(true) {
            case preg_match(self::WITH_IDENTIFIER_PATTERN, $query, $matches):
                $route = $this->detectRouteForWithIdentifierPattern($matches);

                break;
            case preg_match(self::NO_IDENTIFIER_PATTERN, $query, $matches):
                $route = $this->detectRouteForNoIdentifierPattern($matches);

                break;
            default:
                return null;
        }

        return $route;
    }
201989
public function resolveAction()
    {
        $success    = null;
        $failed     = null;
        $service    = $this->getServiceLocator();
        $userModel  = $service->get( 'Grid\User\Model\User\Model' );
        $confirm    = $service->get( 'Grid\User\Model\ConfirmHash' );
        $hash       = $this->params()
                           ->fromRoute( 'hash' );

        if ( $confirm->has( $hash ) &&
             ( $email = $confirm->find( $hash ) ) )
        {
            $user = $userModel->findByEmail( $email );

            if ( ! empty( $user ) &&
                 $user->state != UserStructure::STATE_BANNED )
            {
                $request    = $this->getRequest();
                $data       = $request->getPost();
                $form       = $service->get( 'Form' )
                                      ->get( 'Grid\User\PasswordChangeRequest\Resolve' );

                if ( $request->isPost() )
                {
                    $form->setData( $data );

                    if ( $form->isValid() )
                    {
                        $data = $form->getData();
                        $user->state        = UserStructure::STATE_ACTIVE;
                        $user->confirmed    = true;
                        $user->password     = $data['password'];

                        if ( $user->save() )
                        {
                            $confirm->delete( $hash );
                            $success = true;
                        }
                    }
                    else
                    {
                        $success = false;
                    }
                }
            }
            else
            {
                $failed = true;
            }
        }
        else
        {
            $failed = true;
        }

        if ( $failed === true )
        {
            $this->messenger()
                 ->add( 'user.form.passwordChange.failed',
                        'user', Message::LEVEL_ERROR );

            return $this->redirect()
                        ->toRoute( 'Grid\User\PasswordChangeRequest\Create', array(
                            'locale'    => (string) $this->locale(),
                            'returnUri' => '/',
                        ) );
        }

        if ( $success === true )
        {
            $this->messenger()
                 ->add( 'user.form.passwordChange.success',
                        'user', Message::LEVEL_INFO );

            return $this->redirect()
                        ->toRoute( 'Grid\User\Authentication\Login', array(
                            'locale'    => (string) $this->locale(),
                            'returnUri' => '/',
                        ) );
        }

        if ( $success === false )
        {
            $this->messenger()
                 ->add( 'user.form.passwordChange.resolve.failed',
                        'user', Message::LEVEL_ERROR );
        }

        $this->paragraphLayout();

        return new MetaContent( 'user.passwordChangeRequest', array(
            'success'   => $success,
            'form'      => $form,
        ) );
    }
974873
protected function resolveCurrentUri($exception = NULL)
    {
        try {
            $activeRoutes = $this->getActiveRoutes($exception);
            foreach ($activeRoutes as $controller => $routes) {
                foreach ($routes as $action => $route) {
                    $result = $this->callController($controller, $action, $route);
                    if ($result === TRUE) {
                        return NULL;
                    } else if (!is_null($result)) {
                        return $this->render($result);
                    }
                }
            }
            $this->throw404($exception);
        } catch (\Exception $exception) {
            $this->preventExceptionLoop($exception);
            $this->exceptions[] = $exception;
            return $this->resolveCurrentUri($exception);
        }
    }
697894
public function route( $param = null ) {
		$route = call_user_func( $this->get_route_resolver() );

		if ( is_null( $route ) || is_null( $param ) ) {
			return $route;
		}

		return array_key_exists( $param, $route[2] ) ? $route[2][ $param ] : null;
	}
283173
public function resolve($request = null)
    {
        $request = $request ?: Container::getInstance()->make('request');

        if ($this->resource instanceof Collection)
            $data = $this->resolveCollection($this->resource, $request);
        elseif ($this->resource instanceof AbstractPaginator)
            $data = $this->resolveCollection($this->resource->getCollection(), $request);
        else
            $data = $this->toArray($request);

        if ($data instanceof Arrayable)
            $data = $data->toArray();
        elseif ($data instanceof JsonSerializable)
            $data = $data->jsonSerialize();

        return $this->resolveNestedRelations((array) $data, $request);
    }
416422
public function resolve(): array
    {
        $path = $this->request->query->get('path');
        $method = $this->request->getMethod();

        $result = $this->match("/$path", $method);

        if (empty($result)) {
            $fallback = $this->settings->get('Melior.Routing.fallbackRoute');

            $result = [
                'target' => $this->settings->get("Melior.Routing.routes.$fallback.target"),
                'params' => [],
                'name' => $fallback
            ];
        }

        return $result;
    }
395268
public function resolveAllAction()
    {
        $this->getEntityManager()->getRepository(Exception::class)->markAllAsResolved();

        $indexUrl = $this->getAdminListConfigurator()->getIndexUrl();

        return new RedirectResponse(
            $this->generateUrl(
                $indexUrl['path'],
                isset($indexUrl['params']) ? $indexUrl['params'] : array()
            )
        );
    }
191133
function Request__resolveRoute(routeRule) {
        var route;
        this.route = routeRule.shift();
        this.params = routeRule.shift();
        route = this.route.split('/');
        if (route.length === 3) {
            this.module = route.shift();
        }
        this.controller = route.shift();
        this.action = route.shift();

        if (!!this.module) {
            return this._handleModule(di.getAlias('modulesPath'));
        }

        return this._handleController(di.getAlias('controllersPath'), di.getAlias('viewsPath'));
    }
623936
public function dispatchNotFound()
    {
        if (isset($this->notFoundHandler)) {
            $notFoundHandler = $this->notFoundHandler;
            $controllerName  = implode(
                '\\',
                [
                    $this->baseNamespace,
                    $this->controllerName,
                    $notFoundHandler['controler']
                ]
            );

            $controllerInstance = new $controllerName();

            return call_user_func(
                [
                    $controllerInstance,
                    $this->actionName.$notFoundHandler['action']
                ]
            );
        }

        return null;
    }
648864
protected function resolveResponse()
    {
        if ($evtResponse = $this->fire('kernel.request')) {
            return $evtResponse;
        }

        $controller = $this->router()->match($this->request());

        if (empty($controller)) {
            throw new AppException('No controller was returned from router');
        }

        if ($evtResponse = $this->fire('kernel.route')) {
            return $evtResponse;
        }

        if ($evtResponse = $this->fire('kernel.controller')) {
            return $evtResponse;
        }

        $response = $this->callController($controller);

        if ($evtResponse = $this->fire('kernel.response', $response)) {
            return $evtResponse;
        }

        return $response;
    }
100348
public function adminRoute()
    {
        if ($this->adminRoute === null) {
            $requestUri = (string)$this->httpRequest()->getUri();
            $requestUri = str_replace($this->adminUrl(), '', $requestUri);

            $this->adminRoute = $requestUri;
        }

        return $this->adminRoute;
    }
319265
public function route($request = NULL)
    {
        $matchedResource = NULL;
        if (!$request) {
            $request = new Request();
        }
        foreach ($this->resources as $className => $resourceMetadata) {
            foreach ($resourceMetadata->getUri() as $index => $uri) {
                $uriRegex = '|^'.$uri.'$|';
                if (
                    ($matchedResource == NULL || $matchedResource[0]->getPriority() < $resourceMetadata->getPriority())
                &&
                    preg_match($uriRegex, $request->getUri(), $params)
                ) {
                    array_shift($params);
                    $uriParams = $resourceMetadata->getUriParams($index);
                    if ($uriParams) { // has params within URI
                        foreach ($uriParams as $key => $name) {
                            $params[$name] = $params[$key];
                        }
                    }
                    $matchedResource = array($resourceMetadata, $params);
                }
            }
        }
        if ($matchedResource) {
            $request->setParams($matchedResource[1]);

            return $matchedResource[0];
        } else {
            throw new NotFoundException(sprintf('Resource matching URI "%s" not found', $request->uri));
        }
    }
988678
public function getAction()
    {
        if (!is_null(self::$action)) {
            return self::$action;
        }
        $controllerParam = array_get($this->routeParams, 'controller');
        $match           = null;

        if (!preg_match("/.+?(?=@)@(.*)/", $controllerParam, $match)) {
            return;
        }
        self::$action = strtolower($match[1]);
        return self::$action;
    }
737392
public function resolve()
    {
        $rawParams = $this->getServer();
        if (isset($rawParams[0])) {
            $route = $rawParams[0];
            array_shift($rawParams);
        } else {
            $route = '';
        }

        $params = [];
        foreach ($rawParams as $param) {
            if (preg_match('/^--(\w+)(?:=(.*))?$/', $param, $matches) || preg_match('/^-(\w+)(?:=(.*))?$/', $param, $matches)) {
                $name = $matches[1];
                $params[$name] = isset($matches[2]) ? $matches[2] : true;
            } else {
                $params[] = $param;
            }
        }

        $this->server['path_info'] = $route;
        $this->get                 = $params;
        $this->post                = $params;

        return [$route, $params];
    }
617724
protected function resolveActionMethodName()
    {
        $actionMethodName = $this->request->getControllerActionName() . 'Action';
        if (!is_callable([$this, $actionMethodName])) {
            throw new NoSuchActionException(sprintf('An action "%s" does not exist in controller "%s".', $actionMethodName, get_class($this)), 1186669086);
        }
        $publicActionMethods = static::getPublicActionMethods($this->objectManager);
        if (!isset($publicActionMethods[$actionMethodName])) {
            throw new InvalidActionVisibilityException(sprintf('The action "%s" in controller "%s" is not public!', $actionMethodName, get_class($this)), 1186669086);
        }
        return $actionMethodName;
    }
1220671
public function route()
    {
        $this->Logger->debug("Request: {$this->Request->getFullURL()}");

        $uri = $this->Request->getAdjustedRequestURI();

//        $uri = $this->sanitizeURI($uri);

        $this->Logger->debug("Routing URI: {$uri}");



        $result = array();
        $qs = array_merge($_POST, $_GET);

        $routes = $this->routeService->findAll();

//        $regex = $this->compoundRegex(array_keys($routes));
//        error_log($regex);
//
//        if (! preg_match($regex, $uri, $matches)) {
//            $match = '';
//            error_log('no match');
//            exit;
//            return false;
//        }
//        $match = $matches[0];
//        error_log('match = '.$match);
//        exit;

        $this->Logger->debug("Testing Routes\n");

        foreach ((array)$routes as $test_uri => $nvps) {

            $this->Logger->debug("{$test_uri}");


            $m = null;
            $re = str_replace('/', '\/', $test_uri);
            $match = preg_match('/^' . $re . '$/i', $uri, $m);
            if ($match) {
                if (!empty($nvps) && is_array($nvps)) {
                    foreach ($nvps as $name => $value) {
                        foreach ($m as $n => $v) {
                            $value = str_replace('$'.$n, $v, $value);
                        }

                        foreach ($qs as $n => $v) {
                            if (is_scalar($v))
                                $value = str_replace('$'.$n, $v, $value);
                        }

                        $varparts = null;
                        if (preg_match("/(.+)\[(.+)\]/", $name, $varparts)) {
                            $result[$varparts[1]][$varparts[2]] = $value;
                        } else {
                            $result[$name] = $value;
                        }
                    }
                }

                foreach ($m as $n => $v)
                    if (is_int($n))
                        unset($m[$n]);

                $result = array_merge($m, $result);

                $this->Logger->debug('Routing result:');
                $this->Logger->debug($result);

                return $result;
            }
        }

        $this->checkRedirects();

        $this->Logger->debug("No routes matched.");

        return null;
    }
609557
public function name()
    {
        if ($name = $this->route->getName()) {
            return $name;
        }

        $name = $this->route->getActionName();

        if ($name === 'Closure') {
            return null;
        }

        $namespace = array_get($this->route->getAction(), 'namespace');

        return str_replace($namespace . '\\', '', $name);
    }