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;
    }