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

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

        if (!$currentRequest) {
            return false;
        }

        return IpUtils::checkIp($currentRequest->getClientIp(), $ip);
    }
public function checkPermission($ip, $context)
    {
        if (!is_string($ip)) {
            throw new \TypeError('The ip parameter must be a string.');
        }
        if (!$ip) {
            throw new \InvalidArgumentException('The ip parameter cannot be empty.');
        }

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

        if (!$currentRequest) {
            return false;
        }

        return IpUtils::checkIp($currentRequest->getClientIp(), $ip);
    }
public function checkPermission ( $ ip , $ context ) { if ( ! is_string ( $ ip ) ) { throw new \ TypeError ( 'The ip parameter must be a string.' ) ; } if ( ! $ ip ) { throw new \ InvalidArgumentException ( 'The ip parameter cannot be empty.' ) ; } $ currentRequest = $ this -> requestStack -> getCurrentRequest ( ) ; if ( ! $ currentRequest ) { return false ; } return IpUtils :: checkIp ( $ currentRequest -> getClientIp ( ) , $ ip ) ; }
Checks if the current request comes from an approved ip address

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

@return bool TRUE if the ip is allowed or FALSE if it is not allowed
Checks if the current request comes from an approved ip address