See if the module of a provided route exists in the luya application list.

The module to test must be an instance of `luya\base\Module`.

@param string $route
@return boolean|string
323683
private function findModuleInRoute($route)
    {
        $route = parse_url($route, PHP_URL_PATH);
        
        $parts = array_values(array_filter(explode('/', $route)));
        
        if (isset($parts[0]) && array_key_exists($parts[0], Yii::$app->getApplicationModules())) {
            return $parts[0];
        }
    
        return false;
    }
740551
private function _getDispatchByRoute($route)
    {
        $pos = strpos($route, '/');
        if ($pos === false) {
            $parts = [$this, $route];
        } elseif ($pos > 0) {
            $parts = $this->module->createController($route);
        } else {
            $parts = Yii::$app->createController($route);
        }
        if (is_array($parts)) {
            /* @var $controller self */
            list($controller, $actionID) = $parts;
            $oldController = Yii::$app->controller;
            Yii::$app->controller = $controller;
        } else {
            throw new InvalidRouteException('Unable to resolve the dispatch request: ' . $route);
        }
        
        $dispatch = $controller->_createDispatch($actionID, false);
        
        if ($oldController !== null) {
            Yii::$app->controller = $oldController;
        }
        
        return $dispatch;
    }
344509
private function isParameterisedMatch(array $route)
    {
        // Find out if the route has parameters
        if (!preg_match('/\{[a-z]+\}/i', $route['path'])) {
            return false;
        }

        $routePieces = explode('/', $route['path']);
        $urlPieces = explode('/', $this->path);
        if (count($routePieces) != count($urlPieces)) {
            return false;
        }

        $params = array();
        foreach ($routePieces as $routeKey => $routeValue) {
            if (preg_match('/\{[a-z]+\}/i', $routeValue, $matches)) {
                $paramName = trim($routeValue, '{} ');
                $params[$paramName] = urldecode($urlPieces[$routeKey]);
            } else {
                if ($routeValue != $urlPieces[$routeKey]) {
                    return false;
                }
            }
        }

        $route['params'] = array_merge_recursive($route['params'], $params);

        return $route;
    }
134158
public function isActiveRoute($route)
    {
        $package = $this->getParent()
            ->getView()
            ->getPackage();

        $config = $package->getContainer()
            ->get('config');

        if (count(explode(':', $route)) < 2) {
            $route = $package->getName() . '@' . $route;
        }

        return $config->get('route.matched') == $route ? 'active' : false;
    }
1277784
public function valid($route)
    {
        //argument 1 must be a string
        Argument::i()->test(1, 'string');

        return isset($this->route[strtolower($route)]);
    }
579604
protected function getRouteScheme( $route )
	{
		if ( $route->httpOnly() )
		{
			return $this->getScheme( false );
		}
		elseif ( $route->httpsOnly() )
		{
			return $this->getScheme( true );
		}

		return $this->getScheme( null );
	}
433932
private static function runRouteMiddleware($route)
    {
        $routeMiddleware = Filter::$routeMiddleware;

        if (!is_null($route->getMiddleware())) {
            // if ($route->getMiddleware()['type'] == 'route' && ! is_null($route->getMiddleware()['middlewares'])) {
            foreach ($route->getMiddleware() as $middleware) {
                //Check if the routes middlewares are in filter class
                exception_if(!array_has($routeMiddleware, $middleware), RouteMiddlewareNotFoundException::class, $middleware);

                $middleware = instance($routeMiddleware[$middleware]);

                $middleware->handle(new Request());
            }
        }

        return true;
    }
139865
public function is( $route = '' ) {

		if ( $route == '' ) {
			return self::$destination;
		} else {

			if ( self::$destination == $route ) {
				return TRUE;
			} else {
				return FALSE;
			}

		}

	}
516169
protected function getRouteResource($route)
	{
		if (!config('openapischemas.resource_tag')) {
			$this->parentCommand->error('The "resource_tag" value in your apischemas.php configuration file must defined.');
			exit();
		}
		$routeAction = $route->getAction();
		list($class, $method) = explode('@', $routeAction['uses']);
		$reflection = new ReflectionClass($class);

		$comment = $reflection->getDocComment();
		if ($comment) {
			$docBlock = $this->docBlockFactory->create($comment);
			foreach ($docBlock->getTags() as $tag) {
				if ($tag->getName() === config('openapischemas.resource_tag')) {
					return $tag->getDescription()->render();
				}
			}
		}

		return null;
	}
823978
protected function buildRoute(Route $route)
    {
        if ($route->getBlock()) {
            return $route;
        }

        list($pattern, $params) = $this->parsePlaceholders($route->getPattern());
        return $route->setPatternWithoutReset($pattern)->setParams($params)->setBlock(true);
    }
898983
public function checkRouteBoolean($route)
    {
        if (is_array($route)) {
            $result = call_user_func_array(array($this,'routeIsDeeply'), $route);
        } else {
            $result = $this->routeIsDeeply($route);   
        }
        return $result;
    }
1326889
public function read($route)
    {
        $routePath = $this->getRouteCachePath($route);
        if (!file_exists($routePath)) {
            return false;
        }
        try {
            return File::fromString(file_get_contents($routePath));
        } catch (\Exception $e) {
            //Delete the cache file
            unlink($routePath);
            return false;
        }
    }
414694
protected function filterRoute(array $route)
    {
        if (
            ($this->option('name') && !Str::contains($route['name'], $this->option('name'))) ||
            $this->option('path') && !Str::contains($route['uri'], $this->option('path')) ||
            $this->option('method') && !Str::contains($route['method'], $this->option('method'))
        ) {
            return;
        }

        return $route;
    }
1336278
private function matchesRequest($route)
    {
        $requestURL = $this->requestURL;
        if (isset($route['fullDomainMatch']) && $route['fullDomainMatch'] == true) {
            $requestURL = $this->fullRequestURL;
        }
        if (isset($route['method']) && $route['method'] != $this->requestMethod) {
            return false;
        }
        return preg_match($route['match'], $requestURL, $this->matches);
    }
680782
public function exists($path)
    {
        foreach ($this->route->getList() as $route) {
            if (isset($route['pattern']) && $route['pattern'] === $path) {
                return true;
            }
        }

        return (bool) $this->get(array('alias' => $path));
    }
157158
public static function checkRoute($userId, $route)
    {
        $routes = static::getRoutesByUser($userId);
        $route = '/' . ltrim($route, '/');
        if (isset($routes[$route])) {
            return true;
        }
        while (($pos = strrpos($route, '/')) > 0) {
            $route = substr($route, 0, $pos);
            if (isset($routes[$route . '/*'])) {
                return true;
            }
        }
        return isset($routes['/*']);
    }
135690
public function matches(Route $route, Request $request)
    {
        return in_array($request->getMethod(), $route->methods());
    }