This commit is contained in:
2023-04-15 23:31:16 +08:00
parent 2d9ac93a7a
commit 41a53200b3
69 changed files with 1678 additions and 749 deletions
+33
View File
@@ -5,4 +5,37 @@ namespace Kiri\Router;
class ActionManager
{
private static array $array = [];
/**
* @param string $class
* @param string $method
* @param Handler $handler
* @return void
*/
public static function add(string $class, string $method, Handler $handler): void
{
if (!isset(static::$array[$class])) {
static::$array[$class] = [$method => []];
}
static::$array[$class][$method] = $handler;
}
/**
* @param string $class
* @param string $method
* @return array|null
*/
public static function get(string $class, string $method): ?Handler
{
if (isset(static::$array[$class])) {
return static::$array[$class][$method] ?? null;
}
return null;
}
}