This commit is contained in:
xl
2024-08-29 17:01:08 +08:00
parent 337c52c744
commit c435af1156
15 changed files with 61 additions and 167 deletions
+21 -3
View File
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Kiri\Router\Base;
use Kiri;
use Kiri\Router\Validator\Validator;
class Middleware
{
@@ -12,12 +13,11 @@ class Middleware
/**
* @var array
*/
protected static array $manager = [];
protected static array $mapping = [];
protected static array $validators = [];
/**
* @param string $className
* @param string $method
@@ -47,4 +47,22 @@ class Middleware
}
/**
* @param string $path
* @param array $validators
*/
public static function setValidator(string $path, array $validators): void
{
self::$validators[$path] = $validators;
}
/**
* @param string $path
* @return Validator|null
*/
public static function getValidator(string $path): ?Validator
{
return static::$validators[$path] ?? null;
}
}