public function checkPermission($host, $context)
    {
        if (!is_string($host)) {
            throw new \TypeError('The host parameter must be a string.');
        }
        if (!$host) {
            throw new \InvalidArgumentException('The host parameter cannot be empty.');
        }

        $currentRequest = $this->requestStack->getCurrentRequest();

        if (!$currentRequest) {
            return false;
        }

        return !!preg_match('{'.$host.'}i', $currentRequest->getHost());
    }
public function checkPermission($host, $context)
    {
        if (!is_string($host)) {
            throw new \TypeError('The host parameter must be a string.');
        }
        if (!$host) {
            throw new \InvalidArgumentException('The host parameter cannot be empty.');
        }

        $currentRequest = $this->requestStack->getCurrentRequest();

        if (!$currentRequest) {
            return false;
        }

        return !!preg_match('{'.$host.'}i', $currentRequest->getHost());
    }
public function checkPermission ( $ host , $ context ) { if ( ! is_string ( $ host ) ) { throw new \ TypeError ( 'The host parameter must be a string.' ) ; } if ( ! $ host ) { throw new \ InvalidArgumentException ( 'The host parameter cannot be empty.' ) ; } $ currentRequest = $ this -> requestStack -> getCurrentRequest ( ) ; if ( ! $ currentRequest ) { return false ; } return ! ! preg_match ( '{' . $ host . '}i' , $ currentRequest -> getHost ( ) ) ; }
Checks if the current request is sent to an approved host

@param string $host    The host to evaluate
@param array  $context The context for evaluating the host

@return bool TRUE if the host is allowed or FALSE if it is not allowed
Checks if the current request is sent to an approved host