Bundle/PageBundle/Matcher/UrlMatcher.php
protected function removeLastPart($url)
    {
        $shortenUrl = null;

        if ($url !== null && $url !== '') {
            // split on the / character
            $keywords = preg_split("/\//", $url);

            //if there are some words, we pop the last
            if (count($keywords) > 0) {
                array_pop($keywords);

                //rebuild the url
                $shortenUrl = implode('/', $keywords);
            }
        }

        return $shortenUrl;
    }
protected function removeLastPart($url)
    {
        $shortenUrl = null;

        if ($url !== null && $url !== '') {
            // split on the / character
            $keywords = preg_split("/\//", $url);

            //if there are some words, we pop the last
            if (count($keywords) > 0) {
                array_pop($keywords);

                //rebuild the url
                $shortenUrl = implode('/', $keywords);
            }
        }

        return $shortenUrl;
    }
protected function removeLastPart ( $ url ) { $ shortenUrl = null ; if ( $ url !== null && $ url !== '' ) { // split on the / character $ keywords = preg_split ( "/\//" , $ url ) ; //if there are some words, we pop the last if ( count ( $ keywords ) > 0 ) { array_pop ( $ keywords ) ; //rebuild the url $ shortenUrl = implode ( '/' , $ keywords ) ; } } return $ shortenUrl ; }
Remove the last part of the url.

@param string $url

@return string The shorten url
Remove the last part of the url .