Zend\Mvc\Controller\AbstractRestfulController::addHttpMethodHandler PHP Method

addHttpMethodHandler() public method

This method allows you to handle arbitrary HTTP method types, mapping them to callables. Typically, these will be methods of the controller instance: e.g., array($this, 'foobar'). The typical place to register these is in your constructor. Additionally, as this map is checked prior to testing the standard HTTP methods, this is a way to override what methods will handle the standard HTTP methods. However, if you do this, you will have to retrieve the identifier and any request content manually. Callbacks will be passed the current MvcEvent instance. To retrieve the identifier, you can use "$id = $this->getIdentifier($routeMatch, $request)", passing the appropriate objects. To retrieve the body content data, use "$data = $this->processBodyContent($request)"; that method will return a string, array, or, in the case of JSON, an object.
public addHttpMethodHandler ( string $method, Callable $handler ) : AbstractRestfulController
$method string
$handler Callable
return AbstractRestfulController
    public function addHttpMethodHandler($method, $handler)
    {
        if (!is_callable($handler)) {
            throw new Exception\InvalidArgumentException(sprintf('Invalid HTTP method handler: must be a callable; received "%s"', is_object($handler) ? get_class($handler) : gettype($handler)));
        }
        $method = strtolower($method);
        $this->customHttpMethodsMap[$method] = $handler;
        return $this;
    }