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

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

        if (!$currentRequest) {
            return false;
        }

        return strcasecmp($currentRequest->getMethod(), $method) == 0;
    }
public function checkPermission($method, $context)
    {
        if (!is_string($method)) {
            throw new \TypeError('The method parameter must be a string.');
        }
        if (!$method) {
            throw new \InvalidArgumentException('The method parameter cannot be empty.');
        }

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

        if (!$currentRequest) {
            return false;
        }

        return strcasecmp($currentRequest->getMethod(), $method) == 0;
    }
public function checkPermission ( $ method , $ context ) { if ( ! is_string ( $ method ) ) { throw new \ TypeError ( 'The method parameter must be a string.' ) ; } if ( ! $ method ) { throw new \ InvalidArgumentException ( 'The method parameter cannot be empty.' ) ; } $ currentRequest = $ this -> requestStack -> getCurrentRequest ( ) ; if ( ! $ currentRequest ) { return false ; } return strcasecmp ( $ currentRequest -> getMethod ( ) , $ method ) == 0 ; }
Checks if the current request uses an allowed method

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

@return bool TRUE if the method is allowed or FALSE if it is not allowed
Checks if the current request uses an allowed method