This commit is contained in:
2021-08-05 14:10:52 +08:00
parent 110f02dbf8
commit 517fb75637
3 changed files with 102 additions and 47 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
namespace HttpServer\Route;
use Snowflake\Abstracts\BaseObject;
/**
*
*/
class HandlerProviders extends BaseObject
{
private array $handlers = [];
/**
* @param $path
* @param $method
* @return mixed
*/
public function get($path, $method): mixed
{
return $this->handlers[$method][$path] ?? null;
}
/**
* @param $method
* @param $path
* @param $handler
*/
public function add($method, $path, $handler)
{
$this->handlers[$method][$path] = $handler;
}
}