*/ class RestRoute extends Route { /** * List of HTTP methods that will match with this route * @var array */ protected $allowedMethods = ['GET', 'POST', 'OPTIONS']; public function __construct($methods, $mask, $metadata = [], $flags = 0) { if ($methods) { $this->allowedMethods = array_merge(explode('|', $methods), ['OPTIONS']); } parent::__construct($mask, $metadata, $flags); } /** * Maps HTTP request to a Request object. Does not match, if methods are defined and request * does not match one of them. * * @return Nette\Application\Request|NULL */ public function match(IRequest $httpRequest) : ?array { if (!in_array($httpRequest->getMethod(), $this->allowedMethods)) { return null; } return parent::match($httpRequest); } }