mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-07-11 22:12:18 +00:00
[FEATURE] Added support for patch.
- Put now also allow patch request types.
This commit is contained in:
@@ -10,13 +10,15 @@ abstract class RouterEntry {
|
|||||||
const REQUEST_TYPE_POST = 'post';
|
const REQUEST_TYPE_POST = 'post';
|
||||||
const REQUEST_TYPE_GET = 'get';
|
const REQUEST_TYPE_GET = 'get';
|
||||||
const REQUEST_TYPE_PUT = 'put';
|
const REQUEST_TYPE_PUT = 'put';
|
||||||
|
const REQUEST_TYPE_PATCH = 'patch';
|
||||||
const REQUEST_TYPE_DELETE = 'delete';
|
const REQUEST_TYPE_DELETE = 'delete';
|
||||||
|
|
||||||
public static $allowedRequestTypes = array(
|
public static $allowedRequestTypes = array(
|
||||||
self::REQUEST_TYPE_DELETE,
|
self::REQUEST_TYPE_DELETE,
|
||||||
self::REQUEST_TYPE_GET,
|
self::REQUEST_TYPE_GET,
|
||||||
self::REQUEST_TYPE_POST,
|
self::REQUEST_TYPE_POST,
|
||||||
self::REQUEST_TYPE_PUT
|
self::REQUEST_TYPE_PUT,
|
||||||
|
self::REQUEST_TYPE_PATCH
|
||||||
);
|
);
|
||||||
|
|
||||||
protected $settings;
|
protected $settings;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class SimpleRouter {
|
|||||||
public static function put($url, $callback, array $settings = null) {
|
public static function put($url, $callback, array $settings = null) {
|
||||||
$route = new RouterRoute($url, $callback);
|
$route = new RouterRoute($url, $callback);
|
||||||
$route->addSettings($settings);
|
$route->addSettings($settings);
|
||||||
$route->setRequestMethods(array(RouterRoute::REQUEST_TYPE_PUT));
|
$route->setRequestMethods(array(RouterRoute::REQUEST_TYPE_PUT, RouterRoute::REQUEST_TYPE_PATCH));
|
||||||
|
|
||||||
$router = RouterBase::getInstance();
|
$router = RouterBase::getInstance();
|
||||||
$router->addRoute($route);
|
$router->addRoute($route);
|
||||||
|
|||||||
Reference in New Issue
Block a user