protected function changeMappedValuesOnUrl( $url )
    {
        $newUrl = "";
        foreach ( explode( '/', $url ) as $chunk )
        {
            $newChunk = $this->getValuesFromKeyMap( $chunk );
            if ( empty( $newChunk ) )
            {
                $newChunk = $chunk;
            }

            $newUrl .= '/' . $newChunk;
        }

        return preg_replace( '/\/\//', '/', $newUrl );
    }
protected function changeMappedValuesOnUrl( $url )
    {
        $newUrl = "";
        foreach ( explode( '/', $url ) as $chunk )
        {
            $newChunk = $this->getValuesFromKeyMap( $chunk );
            if ( empty( $newChunk ) )
            {
                $newChunk = $chunk;
            }

            $newUrl .= '/' . $newChunk;
        }

        return preg_replace( '/\/\//', '/', $newUrl );
    }
protected function changeMappedValuesOnUrl ( $ url ) { $ newUrl = "" ; foreach ( explode ( '/' , $ url ) as $ chunk ) { $ newChunk = $ this -> getValuesFromKeyMap ( $ chunk ) ; if ( empty ( $ newChunk ) ) { $ newChunk = $ chunk ; } $ newUrl .= '/' . $ newChunk ; } return preg_replace ( '/\/\//' , '/' , $ newUrl ) ; }
Change the mapped values in key map into the intended URL

ex:
$keyMap = array(
'{id}'      => 123,
'another'   => 'test',
'{extraId}' => 321
);
URL:
before: '/some/url/with/another/and/{id}'
after:  '/some/url/with/test/and/123'

@param string $url URL to update key mapped values

@return string Updated URL
Change the mapped values in key map into the intended URL