eee
This commit is contained in:
+21
-3
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user