public function getNamedUrl($name, $params = array(), $version = null, $locale = null)
    {
        if ($version == null) {
            $version = Registry::get('version');
        }
        if ($locale == null) {
            $locale = Registry::get('locale');
        }
        $foundRoute = false;
        if (isset($this->allRoutesByVersionAndLocale[$version][$locale][$name])) {
            $url = $this->allRoutesByVersionAndLocale[$version][$locale][$name]['regexp'];
            $foundRoute = true;
        } elseif (isset($this->allRoutesByVersionAndLocale[$version]['*'][$name])) {
            $url = $this->allRoutesByVersionAndLocale[$version]['*'][$name]['regexp'];
            $foundRoute = true;
        } elseif (isset($this->allRoutesByVersionAndLocale['*']['*'][$name])) {
            $url = $this->allRoutesByVersionAndLocale['*']['*'][$name]['regexp'];
            $foundRoute = true;
        }
        if ($foundRoute) {
            preg_match_all('/\(([\w_]+):([^)]+)\)/im', $url, $result, PREG_SET_ORDER);
            for ($matchi = 0; $matchi < count($result); $matchi ++) {
                if (isset($params[$result[$matchi][1]])) {
                    $url = str_replace($result[$matchi][0], $params[$result[$matchi][1]], $url);
                }
            }
            return $url;
        } else {
            throw new \Exception('Cannot find route named "' . $name . '" (version=' . $version . ', locale=' . $locale . ')');
        }
    }
public function getNamedUrl($name, $params = array(), $version = null, $locale = null)
    {
        if ($version == null) {
            $version = Registry::get('version');
        }
        if ($locale == null) {
            $locale = Registry::get('locale');
        }
        $foundRoute = false;
        if (isset($this->allRoutesByVersionAndLocale[$version][$locale][$name])) {
            $url = $this->allRoutesByVersionAndLocale[$version][$locale][$name]['regexp'];
            $foundRoute = true;
        } elseif (isset($this->allRoutesByVersionAndLocale[$version]['*'][$name])) {
            $url = $this->allRoutesByVersionAndLocale[$version]['*'][$name]['regexp'];
            $foundRoute = true;
        } elseif (isset($this->allRoutesByVersionAndLocale['*']['*'][$name])) {
            $url = $this->allRoutesByVersionAndLocale['*']['*'][$name]['regexp'];
            $foundRoute = true;
        }
        if ($foundRoute) {
            preg_match_all('/\(([\w_]+):([^)]+)\)/im', $url, $result, PREG_SET_ORDER);
            for ($matchi = 0; $matchi < count($result); $matchi ++) {
                if (isset($params[$result[$matchi][1]])) {
                    $url = str_replace($result[$matchi][0], $params[$result[$matchi][1]], $url);
                }
            }
            return $url;
        } else {
            throw new \Exception('Cannot find route named "' . $name . '" (version=' . $version . ', locale=' . $locale . ')');
        }
    }
public function getNamedUrl ( $ name , $ params = array ( ) , $ version = null , $ locale = null ) { if ( $ version == null ) { $ version = Registry :: get ( 'version' ) ; } if ( $ locale == null ) { $ locale = Registry :: get ( 'locale' ) ; } $ foundRoute = false ; if ( isset ( $ this -> allRoutesByVersionAndLocale [ $ version ] [ $ locale ] [ $ name ] ) ) { $ url = $ this -> allRoutesByVersionAndLocale [ $ version ] [ $ locale ] [ $ name ] [ 'regexp' ] ; $ foundRoute = true ; } elseif ( isset ( $ this -> allRoutesByVersionAndLocale [ $ version ] [ '*' ] [ $ name ] ) ) { $ url = $ this -> allRoutesByVersionAndLocale [ $ version ] [ '*' ] [ $ name ] [ 'regexp' ] ; $ foundRoute = true ; } elseif ( isset ( $ this -> allRoutesByVersionAndLocale [ '*' ] [ '*' ] [ $ name ] ) ) { $ url = $ this -> allRoutesByVersionAndLocale [ '*' ] [ '*' ] [ $ name ] [ 'regexp' ] ; $ foundRoute = true ; } if ( $ foundRoute ) { preg_match_all ( '/\(([\w_]+):([^)]+)\)/im' , $ url , $ result , PREG_SET_ORDER ) ; for ( $ matchi = 0 ; $ matchi < count ( $ result ) ; $ matchi ++ ) { if ( isset ( $ params [ $ result [ $ matchi ] [ 1 ] ] ) ) { $ url = str_replace ( $ result [ $ matchi ] [ 0 ] , $ params [ $ result [ $ matchi ] [ 1 ] ] , $ url ) ; } } return $ url ; } else { throw new \ Exception ( 'Cannot find route named "' . $ name . '" (version=' . $ version . ', locale=' . $ locale . ')' ) ; } }
returns the url from the defined routes by its name
returns the url from the defined routes by its name