@@ -50,8 +50,7 @@ |
||
| 50 | 50 | * A generic Rule that asserts whether the given validation |
| 51 | 51 | * data is valid or not. |
| 52 | 52 | */ |
| 53 | -interface RuleInterface |
|
| 54 | -{ |
|
| 53 | +interface RuleInterface { |
|
| 55 | 54 | /** |
| 56 | 55 | * Method to validate this Rule |
| 57 | 56 | * |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | 'lowercase' => false, |
| 85 | 85 | 'number' => false, |
| 86 | 86 | 'special_chars' => false, |
| 87 | - ], $rules); |
|
| 87 | + ], $rules); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -105,25 +105,25 @@ |
||
| 105 | 105 | return false; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if ($rules['uppercase'] && ((bool)preg_match('~[A-Z]~', $value)) === false) { |
|
| 108 | + if ($rules['uppercase'] && ((bool) preg_match('~[A-Z]~', $value)) === false) { |
|
| 109 | 109 | $this->errorType = self::ERROR_TYPE_UPPERCASE; |
| 110 | 110 | |
| 111 | 111 | return false; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if ($rules['lowercase'] && ((bool)preg_match('~[a-z]~', $value)) === false) { |
|
| 114 | + if ($rules['lowercase'] && ((bool) preg_match('~[a-z]~', $value)) === false) { |
|
| 115 | 115 | $this->errorType = self::ERROR_TYPE_LOWERCASE; |
| 116 | 116 | |
| 117 | 117 | return false; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if ($rules['number'] && ((bool)preg_match('~[0-9]~', $value)) === false) { |
|
| 120 | + if ($rules['number'] && ((bool) preg_match('~[0-9]~', $value)) === false) { |
|
| 121 | 121 | $this->errorType = self::ERROR_TYPE_NUMBER; |
| 122 | 122 | |
| 123 | 123 | return false; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if ($rules['special_chars'] && ((bool)preg_match('~[^\w]~', $value)) === false) { |
|
| 126 | + if ($rules['special_chars'] && ((bool) preg_match('~[^\w]~', $value)) === false) { |
|
| 127 | 127 | $this->errorType = self::ERROR_TYPE_SPECIAL_CHAR; |
| 128 | 128 | |
| 129 | 129 | return false; |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | * @class Password |
| 54 | 54 | * @package Platine\Validator\Rule |
| 55 | 55 | */ |
| 56 | -class Password implements RuleInterface |
|
| 57 | -{ |
|
| 56 | +class Password implements RuleInterface { |
|
| 58 | 57 | /* |
| 59 | 58 | * The error type list |
| 60 | 59 | */ |
@@ -80,8 +79,7 @@ discard block |
||
| 80 | 79 | * Constructor |
| 81 | 80 | * @param array<string, bool|int> $rules |
| 82 | 81 | */ |
| 83 | - public function __construct(array $rules = []) |
|
| 84 | - { |
|
| 82 | + public function __construct(array $rules = []) { |
|
| 85 | 83 | $this->rules = array_merge([ |
| 86 | 84 | 'length' => 5, |
| 87 | 85 | 'uppercase' => false, |
@@ -56,8 +56,7 @@ discard block |
||
| 56 | 56 | * associated metadata for ensuring that a given data set |
| 57 | 57 | * is valid and returned correctly. |
| 58 | 58 | */ |
| 59 | -class Validator |
|
| 60 | -{ |
|
| 59 | +class Validator { |
|
| 61 | 60 | /** |
| 62 | 61 | * The data to validate |
| 63 | 62 | * @var array<string, mixed> |
@@ -112,8 +111,7 @@ discard block |
||
| 112 | 111 | * @param Lang $lang |
| 113 | 112 | * @param string $langDomain |
| 114 | 113 | */ |
| 115 | - public function __construct(Lang $lang, string $langDomain = 'validators') |
|
| 116 | - { |
|
| 114 | + public function __construct(Lang $lang, string $langDomain = 'validators') { |
|
| 117 | 115 | $this->lang = $lang; |
| 118 | 116 | $this->langDomain = $langDomain; |
| 119 | 117 | |
@@ -38,6 +38,5 @@ |
||
| 38 | 38 | * @class ValidatorException |
| 39 | 39 | * @package Platine\Validator\Exception |
| 40 | 40 | */ |
| 41 | -class ValidatorException extends Exception |
|
| 42 | -{ |
|
| 41 | +class ValidatorException extends Exception { |
|
| 43 | 42 | } |
@@ -53,8 +53,7 @@ |
||
| 53 | 53 | * @class AlphaNumericDash |
| 54 | 54 | * @package Platine\Validator\Rule |
| 55 | 55 | */ |
| 56 | -class AlphaNumericDash implements RuleInterface |
|
| 57 | -{ |
|
| 56 | +class AlphaNumericDash implements RuleInterface { |
|
| 58 | 57 | /** |
| 59 | 58 | * String pattern to allow |
| 60 | 59 | * @var string |
@@ -59,13 +59,13 @@ |
||
| 59 | 59 | * Value to compare against |
| 60 | 60 | * @var string|float|int|bool|null |
| 61 | 61 | */ |
| 62 | - protected string|float|int|bool|null $value; |
|
| 62 | + protected string | float | int | bool | null $value; |
|
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * Constructor |
| 66 | 66 | * @param string|float|int|bool|null $value the value to compare against |
| 67 | 67 | */ |
| 68 | - public function __construct(string|float|int|bool|null $value) |
|
| 68 | + public function __construct(string | float | int | bool | null $value) |
|
| 69 | 69 | { |
| 70 | 70 | $this->value = $value; |
| 71 | 71 | } |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | * @class Max |
| 54 | 54 | * @package Platine\Validator\Rule |
| 55 | 55 | */ |
| 56 | -class Max implements RuleInterface |
|
| 57 | -{ |
|
| 56 | +class Max implements RuleInterface { |
|
| 58 | 57 | /** |
| 59 | 58 | * Value to compare against |
| 60 | 59 | * @var string|float|int|bool|null |
@@ -65,8 +64,7 @@ discard block |
||
| 65 | 64 | * Constructor |
| 66 | 65 | * @param string|float|int|bool|null $value the value to compare against |
| 67 | 66 | */ |
| 68 | - public function __construct(string|float|int|bool|null $value) |
|
| 69 | - { |
|
| 67 | + public function __construct(string|float|int|bool|null $value) { |
|
| 70 | 68 | $this->value = $value; |
| 71 | 69 | } |
| 72 | 70 | |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | * @class DateBefore |
| 54 | 54 | * @package Platine\Validator\Rule |
| 55 | 55 | */ |
| 56 | -class DateBefore implements RuleInterface |
|
| 57 | -{ |
|
| 56 | +class DateBefore implements RuleInterface { |
|
| 58 | 57 | /** |
| 59 | 58 | * The date to compare against |
| 60 | 59 | * @var string |
@@ -72,8 +71,7 @@ discard block |
||
| 72 | 71 | * @param string $date the date format |
| 73 | 72 | * @param bool $include |
| 74 | 73 | */ |
| 75 | - public function __construct(string $date, bool $include = false) |
|
| 76 | - { |
|
| 74 | + public function __construct(string $date, bool $include = false) { |
|
| 77 | 75 | $this->date = $date; |
| 78 | 76 | $this->include = $include; |
| 79 | 77 | } |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | * @class InList |
| 54 | 54 | * @package Platine\Validator\Rule |
| 55 | 55 | */ |
| 56 | -class InList implements RuleInterface |
|
| 57 | -{ |
|
| 56 | +class InList implements RuleInterface { |
|
| 58 | 57 | /** |
| 59 | 58 | * The list to match |
| 60 | 59 | * @var array<mixed> |
@@ -65,8 +64,7 @@ discard block |
||
| 65 | 64 | * Constructor |
| 66 | 65 | * @param array<mixed> $list |
| 67 | 66 | */ |
| 68 | - public function __construct(array $list) |
|
| 69 | - { |
|
| 67 | + public function __construct(array $list) { |
|
| 70 | 68 | $this->list = $list; |
| 71 | 69 | } |
| 72 | 70 | |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | * @class NotEqual |
| 54 | 54 | * @package Platine\Validator\Rule |
| 55 | 55 | */ |
| 56 | -class NotEqual implements RuleInterface |
|
| 57 | -{ |
|
| 56 | +class NotEqual implements RuleInterface { |
|
| 58 | 57 | /** |
| 59 | 58 | * Value to compare against |
| 60 | 59 | * @var mixed |
@@ -65,8 +64,7 @@ discard block |
||
| 65 | 64 | * Constructor |
| 66 | 65 | * @param mixed $value the value to compare against |
| 67 | 66 | */ |
| 68 | - public function __construct(mixed $value) |
|
| 69 | - { |
|
| 67 | + public function __construct(mixed $value) { |
|
| 70 | 68 | $this->value = $value; |
| 71 | 69 | } |
| 72 | 70 | |