Files
kiri-validator/RoundValidator.php
T

29 lines
414 B
PHP
Raw Normal View History

2022-01-09 14:01:11 +08:00
<?php
namespace validator;
use Exception;
/**
* Class RoundValidator
* @package validator
*/
class RoundValidator extends BaseValidator
{
2023-12-12 15:35:34 +08:00
/**
2023-12-18 15:01:09 +08:00
* @param string $field
* @param mixed $value
2023-12-12 15:35:34 +08:00
* @return bool
* @throws
*/
2023-12-18 15:01:09 +08:00
public function trigger(string $field, mixed $value): bool
2023-12-12 15:35:34 +08:00
{
2023-12-18 15:01:09 +08:00
return round($value, $this->value) == $value;
2023-12-12 15:35:34 +08:00
}
2022-01-09 14:01:11 +08:00
}