Bundle/PageBundle/Matcher/UrlMatcher.php
protected function extractPartByPosition($url, $position)
    {
        $part = null;

        if ($url !== null && $url !== '') {
            // split on the / character
            $keywords = preg_split("/\//", $url);
            // preg_match_all('/\{\%\s*([^\%\}]*)\s*\%\}|\{\{\s*([^\}\}]*)\s*\}\}/i', $url, $matches);

            //if there are some words, we pop the last
            if (count($keywords) > 0) {
                //get the part
                $part = $keywords[$position - 1];
            }
        }

        return $part;
    }
protected function extractPartByPosition($url, $position)
    {
        $part = null;

        if ($url !== null && $url !== '') {
            // split on the / character
            $keywords = preg_split("/\//", $url);
            // preg_match_all('/\{\%\s*([^\%\}]*)\s*\%\}|\{\{\s*([^\}\}]*)\s*\}\}/i', $url, $matches);

            //if there are some words, we pop the last
            if (count($keywords) > 0) {
                //get the part
                $part = $keywords[$position - 1];
            }
        }

        return $part;
    }
protected function extractPartByPosition ( $ url , $ position ) { $ part = null ; if ( $ url !== null && $ url !== '' ) { // split on the / character $ keywords = preg_split ( "/\//" , $ url ) ; // preg_match_all('/\{\%\s*([^\%\}]*)\s*\%\}|\{\{\s*([^\}\}]*)\s*\}\}/i', $url, $matches); //if there are some words, we pop the last if ( count ( $ keywords ) > 0 ) { //get the part $ part = $ keywords [ $ position - 1 ] ; } } return $ part ; }
Extract a part of the url.

@param string $url
@param int    $position

@return string The extracted part
Extract a part of the url .