src/Sulu/Bundle/AudienceTargetingBundle/Rule/ReferrerRule.php
public function evaluate(array $options)
    {
        $request = $this->requestStack->getCurrentRequest();
        $referrer = $request->headers->get('referer');
        if ($this->referrerHeader && $request->headers->has($this->referrerHeader)) {
            $referrer = $request->headers->get($this->referrerHeader);
        }

        return (bool) preg_match(
            '/^' . str_replace(['*', '/'], ['(.*)', '\/'], $options[static::REFERRER]) . '$/',
            $referrer
        );
    }
public function evaluate(array $options)
    {
        $request = $this->requestStack->getCurrentRequest();
        $referrer = $request->headers->get('referer');
        if ($this->referrerHeader && $request->headers->has($this->referrerHeader)) {
            $referrer = $request->headers->get($this->referrerHeader);
        }

        return (bool) preg_match(
            '/^' . str_replace(['*', '/'], ['(.*)', '\/'], $options[static::REFERRER]) . '$/',
            $referrer
        );
    }
public function evaluate ( array $ options ) { $ request = $ this -> requestStack -> getCurrentRequest ( ) ; $ referrer = $ request -> headers -> get ( 'referer' ) ; if ( $ this -> referrerHeader && $ request -> headers -> has ( $ this -> referrerHeader ) ) { $ referrer = $ request -> headers -> get ( $ this -> referrerHeader ) ; } return ( bool ) preg_match ( '/^' . str_replace ( [ '*' , '/' ] , [ '(.*)' , '\/' ] , $ options [ static :: REFERRER ] ) . '$/' , $ referrer ) ; }
Returns a string representation of the evaluation of the rule for the current context.

@param array $options The options to evaluate against

@return bool
Returns a string representation of the evaluation of the rule for the current context .