eee
This commit is contained in:
@@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||||||
namespace validator;
|
namespace validator;
|
||||||
|
|
||||||
|
|
||||||
use ReflectionException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ArrayValidator
|
* Class ArrayValidator
|
||||||
* @package validator
|
* @package validator
|
||||||
@@ -23,7 +21,6 @@ class ArrayValidator extends BaseValidator
|
|||||||
* @return bool
|
* @return bool
|
||||||
*
|
*
|
||||||
* 检查
|
* 检查
|
||||||
* @throws ReflectionException
|
|
||||||
*/
|
*/
|
||||||
public function trigger(): bool
|
public function trigger(): bool
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ namespace validator;
|
|||||||
use Database\Model;
|
use Database\Model;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class \validator\BaseValidator
|
||||||
|
*/
|
||||||
abstract class BaseValidator
|
abstract class BaseValidator
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ class DateTimeValidator extends BaseValidator
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param $field
|
||||||
* @param $value
|
* @param $value
|
||||||
* @return bool
|
* @return bool
|
||||||
*
|
*
|
||||||
@@ -60,6 +61,7 @@ class DateTimeValidator extends BaseValidator
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param $field
|
||||||
* @param $value
|
* @param $value
|
||||||
* @return bool
|
* @return bool
|
||||||
*
|
*
|
||||||
@@ -80,6 +82,7 @@ class DateTimeValidator extends BaseValidator
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param $field
|
||||||
* @param $value
|
* @param $value
|
||||||
* @return bool
|
* @return bool
|
||||||
*
|
*
|
||||||
@@ -99,6 +102,7 @@ class DateTimeValidator extends BaseValidator
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @param $field
|
||||||
* @param $value
|
* @param $value
|
||||||
* @return bool
|
* @return bool
|
||||||
*
|
*
|
||||||
|
|||||||
+3
-2
@@ -9,14 +9,15 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace validator;
|
namespace validator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
class EmailValidator extends BaseValidator
|
class EmailValidator extends BaseValidator
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
* 检查是否存在
|
* 检查是否存在
|
||||||
* @throws \ReflectionException
|
|
||||||
*/
|
*/
|
||||||
public function trigger(): bool
|
public function trigger(): bool
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-3
@@ -12,8 +12,9 @@ declare(strict_types=1);
|
|||||||
namespace validator;
|
namespace validator;
|
||||||
|
|
||||||
|
|
||||||
use ReflectionException;
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
class EmptyValidator extends BaseValidator
|
class EmptyValidator extends BaseValidator
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -29,7 +30,6 @@ class EmptyValidator extends BaseValidator
|
|||||||
* @return bool
|
* @return bool
|
||||||
*
|
*
|
||||||
* 检查参数是否为NULL
|
* 检查参数是否为NULL
|
||||||
* @throws ReflectionException
|
|
||||||
*/
|
*/
|
||||||
public function trigger(): bool
|
public function trigger(): bool
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ class EnumValidator extends BaseValidator
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws \ReflectionException
|
|
||||||
*/
|
*/
|
||||||
public function trigger(): bool
|
public function trigger(): bool
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ declare(strict_types=1);
|
|||||||
namespace validator;
|
namespace validator;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
class IntegerValidator extends BaseValidator
|
class IntegerValidator extends BaseValidator
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -21,7 +24,6 @@ class IntegerValidator extends BaseValidator
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws \ReflectionException
|
|
||||||
*/
|
*/
|
||||||
public function trigger(): bool
|
public function trigger(): bool
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ declare(strict_types=1);
|
|||||||
namespace validator;
|
namespace validator;
|
||||||
|
|
||||||
|
|
||||||
use ReflectionException;
|
|
||||||
|
|
||||||
class LengthValidator extends BaseValidator
|
class LengthValidator extends BaseValidator
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -24,7 +22,6 @@ class LengthValidator extends BaseValidator
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
* @throws ReflectionException
|
|
||||||
*/
|
*/
|
||||||
public function trigger(): bool
|
public function trigger(): bool
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ class RequiredValidator extends BaseValidator
|
|||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
* 检查是否存在
|
* 检查是否存在
|
||||||
* @throws \ReflectionException
|
|
||||||
*/
|
*/
|
||||||
public function trigger(): bool
|
public function trigger(): bool
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -112,10 +112,10 @@ class Validator extends BaseValidator
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param BaseValidator|array|Closure $val
|
* @param BaseValidator|array|Closure $val
|
||||||
* @return mixed
|
* @return array
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function check(BaseValidator|array|Closure $val): mixed
|
private function check(BaseValidator|array|Closure $val): array
|
||||||
{
|
{
|
||||||
if (is_callable($val, true)) {
|
if (is_callable($val, true)) {
|
||||||
return [call_user_func($val, $this), $val];
|
return [call_user_func($val, $this), $val];
|
||||||
|
|||||||
Reference in New Issue
Block a user