Drahak\Restful\Application\Events\MethodHandler::checkAllowedMethods PHP Method

checkAllowedMethods() protected method

Check allowed methods
protected checkAllowedMethods ( )
    protected function checkAllowedMethods()
    {
        $availableMethods = $this->methods->getOptions($this->request->getUrl());
        if (!$availableMethods || in_array($this->request->method, $availableMethods)) {
            return;
        }
        $allow = implode(', ', $availableMethods);
        $this->response->setHeader('Allow', $allow);
        throw BadRequestException::methodNotSupported('Method not supported. Available methods: ' . $allow);
    }