src/Core/Helpers/UrlHelper.php
public static function routeParse($from, $to, $url)
    {
        // validation and parse route pattern
        $result = preg_match('/^(\(([^\)]+)\)|[^\/]*)(.*)/', $from, $data);

        if ($result !== 1) {
            return false;
        }

        // prepare patter to test url and replacement
        $pattern = '/^' . str_replace('/', '\/', $data[3]) . '$/';

        // test route pattern match
        $result = preg_match($pattern, $url);

        if ($result !== 1) {
            return false;
        }

        // create RouteInfo object and fill fields
        $route = new RouteInfo();
        // make array of supported methods
        $route->methods = empty($data[2]) ? [] : explode('|', $data[2]);
        // replace pattern url
        $route->url = preg_replace($pattern, $to, $url);

        return $route;
    }
public static function routeParse($from, $to, $url)
    {
        // validation and parse route pattern
        $result = preg_match('/^(\(([^\)]+)\)|[^\/]*)(.*)/', $from, $data);

        if ($result !== 1) {
            return false;
        }

        // prepare patter to test url and replacement
        $pattern = '/^' . str_replace('/', '\/', $data[3]) . '$/';

        // test route pattern match
        $result = preg_match($pattern, $url);

        if ($result !== 1) {
            return false;
        }

        // create RouteInfo object and fill fields
        $route = new RouteInfo();
        // make array of supported methods
        $route->methods = empty($data[2]) ? [] : explode('|', $data[2]);
        // replace pattern url
        $route->url = preg_replace($pattern, $to, $url);

        return $route;
    }
public static function routeParse ( $ from , $ to , $ url ) { // validation and parse route pattern $ result = preg_match ( '/^(\(([^\)]+)\)|[^\/]*)(.*)/' , $ from , $ data ) ; if ( $ result !== 1 ) { return false ; } // prepare patter to test url and replacement $ pattern = '/^' . str_replace ( '/' , '\/' , $ data [ 3 ] ) . '$/' ; // test route pattern match $ result = preg_match ( $ pattern , $ url ) ; if ( $ result !== 1 ) { return false ; } // create RouteInfo object and fill fields $ route = new RouteInfo ( ) ; // make array of supported methods $ route -> methods = empty ( $ data [ 2 ] ) ? [ ] : explode ( '|' , $ data [ 2 ] ) ; // replace pattern url $ route -> url = preg_replace ( $ pattern , $ to , $ url ) ; return $ route ; }
Parse route and return object RouteInfo with information about accepted
route or return false if route pattern does not math

@param string $from
@param string $to
@param string $url
@return bool|RouteInfo
Parse route and return object RouteInfo with information about accepted route or return false if route pattern does not math