public function getRedirect($source)
    {
        foreach ($this->redirections as $redirection)
        {
            if(false !== ($wildcardPos = strpos($redirection['source'], '*')))
            {
                if(substr($source, 0, $wildcardPos) == substr($redirection['source'], 0, $wildcardPos))
                {
                    return array(
                        rtrim($redirection['target'], '*') . substr($source, $wildcardPos),
                        $redirection['type']
                    );
                }
            }
            else
            {
                if($source == $redirection['source'])
                {
                    return array($redirection['target'], $redirection['type']);
                }
            }
        }
        return null;
    }
public function getRedirect($source)
    {
        foreach ($this->redirections as $redirection)
        {
            if(false !== ($wildcardPos = strpos($redirection['source'], '*')))
            {
                if(substr($source, 0, $wildcardPos) == substr($redirection['source'], 0, $wildcardPos))
                {
                    return array(
                        rtrim($redirection['target'], '*') . substr($source, $wildcardPos),
                        $redirection['type']
                    );
                }
            }
            else
            {
                if($source == $redirection['source'])
                {
                    return array($redirection['target'], $redirection['type']);
                }
            }
        }
        return null;
    }
public function getRedirect ( $ source ) { foreach ( $ this -> redirections as $ redirection ) { if ( false !== ( $ wildcardPos = strpos ( $ redirection [ 'source' ] , '*' ) ) ) { if ( substr ( $ source , 0 , $ wildcardPos ) == substr ( $ redirection [ 'source' ] , 0 , $ wildcardPos ) ) { return array ( rtrim ( $ redirection [ 'target' ] , '*' ) . substr ( $ source , $ wildcardPos ) , $ redirection [ 'type' ] ) ; } } else { if ( $ source == $ redirection [ 'source' ] ) { return array ( $ redirection [ 'target' ] , $ redirection [ 'type' ] ) ; } } } return null ; }
Returns redirection for source

@param  string  $source Source url
@return array           array('redirection target', 301|302)
Returns redirection for source