public function allowMethod($methods)
    {
        $methods = (array)$methods;
        foreach ($methods as $method) {
            if ($this->is($method)) {
                return true;
            }
        }
        $allowed = strtoupper(implode(', ', $methods));
        $e = new MethodNotAllowedException();
        $e->responseHeader('Allow', $allowed);
        throw $e;
    }
public function allowMethod($methods)
    {
        $methods = (array)$methods;
        foreach ($methods as $method) {
            if ($this->is($method)) {
                return true;
            }
        }
        $allowed = strtoupper(implode(', ', $methods));
        $e = new MethodNotAllowedException();
        $e->responseHeader('Allow', $allowed);
        throw $e;
    }
public function allowMethod ( $ methods ) { $ methods = ( array ) $ methods ; foreach ( $ methods as $ method ) { if ( $ this -> is ( $ method ) ) { return true ; } } $ allowed = strtoupper ( implode ( ', ' , $ methods ) ) ; $ e = new MethodNotAllowedException ( ) ; $ e -> responseHeader ( 'Allow' , $ allowed ) ; throw $ e ; }
Allow only certain HTTP request methods, if the request method does not match
a 405 error will be shown and the required "Allow" response header will be set.

Example:

$this->request->allowMethod('post');
or
$this->request->allowMethod(['post', 'delete']);

If the request would be GET, response header "Allow: POST, DELETE" will be set
and a 405 error will be returned.

@param string|array $methods Allowed HTTP request methods.
@return bool true
@throws \Cake\Http\Exception\MethodNotAllowedException
Allow only certain HTTP request methods if the request method does not match a 405 error will be shown and the required Allow response header will be set .