@@ -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 | */ |
@@ -74,8 +73,7 @@ discard block |
||
74 | 73 | * Constructor |
75 | 74 | * @param array<string, bool|int> $rules |
76 | 75 | */ |
77 | - public function __construct(protected array $rules = []) |
|
78 | - { |
|
76 | + public function __construct(protected array $rules = []) { |
|
79 | 77 | $this->rules = array_merge([ |
80 | 78 | 'length' => 5, |
81 | 79 | 'uppercase' => false, |
@@ -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 |
@@ -53,8 +53,7 @@ |
||
53 | 53 | * @class Natural |
54 | 54 | * @package Platine\Validator\Rule |
55 | 55 | */ |
56 | -class Natural implements RuleInterface |
|
57 | -{ |
|
56 | +class Natural implements RuleInterface { |
|
58 | 57 | /** |
59 | 58 | * {@inheritdoc} |
60 | 59 | * @see RuleInterface |
@@ -53,8 +53,7 @@ |
||
53 | 53 | * @class IP |
54 | 54 | * @package Platine\Validator\Rule |
55 | 55 | */ |
56 | -class IP implements RuleInterface |
|
57 | -{ |
|
56 | +class IP implements RuleInterface { |
|
58 | 57 | /** |
59 | 58 | * {@inheritdoc} |
60 | 59 | * @see RuleInterface |
@@ -53,8 +53,7 @@ |
||
53 | 53 | * @class URL |
54 | 54 | * @package Platine\Validator\Rule |
55 | 55 | */ |
56 | -class URL implements RuleInterface |
|
57 | -{ |
|
56 | +class URL implements RuleInterface { |
|
58 | 57 | /** |
59 | 58 | * {@inheritdoc} |
60 | 59 | * @see RuleInterface |
@@ -53,8 +53,7 @@ |
||
53 | 53 | * @class Alpha |
54 | 54 | * @package Platine\Validator\Rule |
55 | 55 | */ |
56 | -class Alpha implements RuleInterface |
|
57 | -{ |
|
56 | +class Alpha implements RuleInterface { |
|
58 | 57 | /** |
59 | 58 | * String pattern to allow |
60 | 59 | * @var string |
@@ -53,8 +53,7 @@ |
||
53 | 53 | * @class IPv4 |
54 | 54 | * @package Platine\Validator\Rule |
55 | 55 | */ |
56 | -class IPv4 implements RuleInterface |
|
57 | -{ |
|
56 | +class IPv4 implements RuleInterface { |
|
58 | 57 | /** |
59 | 58 | * {@inheritdoc} |
60 | 59 | * @see RuleInterface |