Files
kiri-router/src/Validator/Inject/Max.php
T
2023-04-16 01:24:30 +08:00

32 lines
531 B
PHP

<?php
declare(strict_types=1);
namespace Kiri\Router\Validator\Inject;
use Kiri\Router\Interface\ValidatorInterface;
#[\Attribute(\Attribute::TARGET_PROPERTY)]
class Max implements ValidatorInterface
{
/**
* @param int $value
*/
public function __construct(readonly public int $value)
{
}
/**
* @param object $class
* @param string $name
* @return bool
*/
public function dispatch(object $class, string $name): bool
{
// TODO: Implement dispatch() method.
return $class->{$name} <= $this->value;
}
}