@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace HnrAzevedo\Validator; |
4 | 4 | |
5 | -Trait ExtraCheck{ |
|
5 | +Trait ExtraCheck { |
|
6 | 6 | protected static array $data = []; |
7 | 7 | protected static array $validators = []; |
8 | 8 | protected static string $model = ''; |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | |
12 | 12 | protected static function check_requireds() |
13 | 13 | { |
14 | - if(count(self::$required) > 0){ |
|
14 | + if (count(self::$required)>0) { |
|
15 | 15 | self::$errors[] = [ |
16 | - 'As seguintes informações não poderam ser validadas: '.implode(', ',array_keys(self::$required)).'.' |
|
16 | + 'As seguintes informações não poderam ser validadas: '.implode(', ', array_keys(self::$required)).'.' |
|
17 | 17 | ]; |
18 | 18 | } |
19 | 19 | } |
@@ -21,22 +21,22 @@ discard block |
||
21 | 21 | public static function validateDate($date, $format = 'Y-m-d H:i:s') |
22 | 22 | { |
23 | 23 | $d = \DateTime::createFromFormat($format, $date); |
24 | - return $d && $d->format($format) == $date; |
|
24 | + return $d && $d->format($format)==$date; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | protected static function check_required(string $param): bool |
28 | 28 | { |
29 | - return (array_key_exists('required',self::$validators[self::$model]->getRules(self::$data['role'])[$param]) && self::$validators[self::$model]->getRules(self::$data['role'])[$param]['required']); |
|
29 | + return (array_key_exists('required', self::$validators[self::$model]->getRules(self::$data['role'])[$param]) && self::$validators[self::$model]->getRules(self::$data['role'])[$param]['required']); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | protected static function toNext(string $param, $value) |
33 | 33 | { |
34 | - return (self::check_required($param) || strlen($value > 0)); |
|
34 | + return (self::check_required($param) || strlen($value>0)); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | protected static function testArray(string $param, $value): ?array |
38 | 38 | { |
39 | - if(!is_array($value)){ |
|
39 | + if (!is_array($value)) { |
|
40 | 40 | self::$errors[] = [ |
41 | 41 | $param => 'Era esperado um informação em array para está informação.' |
42 | 42 | ]; |