Files
kiri-router/src/ActionManager.php
T

42 lines
696 B
PHP
Raw Normal View History

2023-04-15 23:29:27 +08:00
<?php
namespace Kiri\Router;
class ActionManager
{
2023-04-15 23:31:16 +08:00
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;
}
2023-04-15 23:29:27 +08:00
}