@@ -76,8 +76,7 @@ |
||
76 | 76 | $isOk = in_array($value, $values); |
77 | 77 | |
78 | 78 | return $isOk === true ? |
79 | - BlockReplies::createSuccessReply($value) : |
|
80 | - BlockReplies::createErrorReply($context, $value, ErrorCodes::INVALID_VALUE); |
|
79 | + BlockReplies::createSuccessReply($value) : BlockReplies::createErrorReply($context, $value, ErrorCodes::INVALID_VALUE); |
|
81 | 80 | } |
82 | 81 | |
83 | 82 | /** |
@@ -91,8 +91,7 @@ |
||
91 | 91 | $output = filter_var($value, $filterId, $filterOptions); |
92 | 92 | |
93 | 93 | return $output !== false ? |
94 | - BlockReplies::createSuccessReply($output) : |
|
95 | - BlockReplies::createErrorReply($context, $value, ErrorCodes::INVALID_VALUE, [$filterId, $filterOptions]); |
|
94 | + BlockReplies::createSuccessReply($output) : BlockReplies::createErrorReply($context, $value, ErrorCodes::INVALID_VALUE, [$filterId, $filterOptions]); |
|
96 | 95 | } |
97 | 96 | |
98 | 97 | /** |
@@ -54,8 +54,7 @@ discard block |
||
54 | 54 | protected static function equals($value, RuleInterface $next = null): RuleInterface |
55 | 55 | { |
56 | 56 | return $next === null ? |
57 | - $value instanceof DateTimeInterface ? new DateTimeEquals($value) : new ScalarEquals($value) : |
|
58 | - new AndOperator(static::equals($value), $next); |
|
57 | + $value instanceof DateTimeInterface ? new DateTimeEquals($value) : new ScalarEquals($value) : new AndOperator(static::equals($value), $next); |
|
59 | 58 | } |
60 | 59 | |
61 | 60 | /** |
@@ -67,8 +66,7 @@ discard block |
||
67 | 66 | protected static function notEquals($value, RuleInterface $next = null): RuleInterface |
68 | 67 | { |
69 | 68 | return $next === null ? |
70 | - $value instanceof DateTimeInterface ? new DateTimeNotEquals($value) : new ScalarNotEquals($value) : |
|
71 | - new AndOperator(static::notEquals($value), $next); |
|
69 | + $value instanceof DateTimeInterface ? new DateTimeNotEquals($value) : new ScalarNotEquals($value) : new AndOperator(static::notEquals($value), $next); |
|
72 | 70 | } |
73 | 71 | |
74 | 72 | /** |
@@ -91,8 +89,7 @@ discard block |
||
91 | 89 | protected static function lessThan($value, RuleInterface $next = null): RuleInterface |
92 | 90 | { |
93 | 91 | return $next === null ? |
94 | - $value instanceof DateTimeInterface ? new DateTimeLessThan($value) : new NumericLessThan($value) : |
|
95 | - new AndOperator(static::lessThan($value), $next); |
|
92 | + $value instanceof DateTimeInterface ? new DateTimeLessThan($value) : new NumericLessThan($value) : new AndOperator(static::lessThan($value), $next); |
|
96 | 93 | } |
97 | 94 | |
98 | 95 | /** |
@@ -104,8 +101,7 @@ discard block |
||
104 | 101 | protected static function lessOrEquals($value, RuleInterface $next = null): RuleInterface |
105 | 102 | { |
106 | 103 | return $next === null ? |
107 | - $value instanceof DateTimeInterface ? new DateTimeLessOrEquals($value) : new NumericLessOrEquals($value) : |
|
108 | - new AndOperator(static::lessOrEquals($value), $next); |
|
104 | + $value instanceof DateTimeInterface ? new DateTimeLessOrEquals($value) : new NumericLessOrEquals($value) : new AndOperator(static::lessOrEquals($value), $next); |
|
109 | 105 | } |
110 | 106 | |
111 | 107 | /** |
@@ -117,8 +113,7 @@ discard block |
||
117 | 113 | protected static function moreThan($value, RuleInterface $next = null): RuleInterface |
118 | 114 | { |
119 | 115 | return $next === null ? |
120 | - $value instanceof DateTimeInterface ? new DateTimeMoreThan($value) : new NumericMoreThan($value) : |
|
121 | - new AndOperator(static::moreThan($value), $next); |
|
116 | + $value instanceof DateTimeInterface ? new DateTimeMoreThan($value) : new NumericMoreThan($value) : new AndOperator(static::moreThan($value), $next); |
|
122 | 117 | } |
123 | 118 | |
124 | 119 | /** |
@@ -131,8 +126,7 @@ discard block |
||
131 | 126 | { |
132 | 127 | return $next === null ? |
133 | 128 | ($value instanceof DateTimeInterface ? |
134 | - new DateTimeMoreOrEquals($value) : new NumericMoreOrEqualsThan($value)) : |
|
135 | - new AndOperator(static::moreOrEquals($value), $next); |
|
129 | + new DateTimeMoreOrEquals($value) : new NumericMoreOrEqualsThan($value)) : new AndOperator(static::moreOrEquals($value), $next); |
|
136 | 130 | } |
137 | 131 | |
138 | 132 | /** |
@@ -148,8 +142,7 @@ discard block |
||
148 | 142 | |
149 | 143 | return $next === null ? |
150 | 144 | ($areLimitsDates ? |
151 | - new DateTimeBetween($lowerLimit, $upperLimit) : new NumericBetween($lowerLimit, $upperLimit)) : |
|
152 | - new AndOperator(static::between($lowerLimit, $upperLimit), $next); |
|
145 | + new DateTimeBetween($lowerLimit, $upperLimit) : new NumericBetween($lowerLimit, $upperLimit)) : new AndOperator(static::between($lowerLimit, $upperLimit), $next); |
|
153 | 146 | } |
154 | 147 | |
155 | 148 | /** |
@@ -162,8 +155,7 @@ discard block |
||
162 | 155 | protected static function stringLengthBetween(int $min, int $max, RuleInterface $next = null): RuleInterface |
163 | 156 | { |
164 | 157 | return $next === null ? |
165 | - new StringLengthBetween($min, $max) : |
|
166 | - new AndOperator(static::stringLengthBetween($min, $max), $next); |
|
158 | + new StringLengthBetween($min, $max) : new AndOperator(static::stringLengthBetween($min, $max), $next); |
|
167 | 159 | } |
168 | 160 | |
169 | 161 | /** |
@@ -175,8 +167,7 @@ discard block |
||
175 | 167 | protected static function stringLengthMin(int $min, RuleInterface $next = null): RuleInterface |
176 | 168 | { |
177 | 169 | return $next === null ? |
178 | - new StringLengthMin($min) : |
|
179 | - new AndOperator(static::stringLengthMin($min), $next); |
|
170 | + new StringLengthMin($min) : new AndOperator(static::stringLengthMin($min), $next); |
|
180 | 171 | } |
181 | 172 | |
182 | 173 | /** |
@@ -188,8 +179,7 @@ discard block |
||
188 | 179 | protected static function stringLengthMax(int $max, RuleInterface $next = null): RuleInterface |
189 | 180 | { |
190 | 181 | return $next === null ? |
191 | - new StringLengthMax($max) : |
|
192 | - new AndOperator(static::stringLengthMax($max), $next); |
|
182 | + new StringLengthMax($max) : new AndOperator(static::stringLengthMax($max), $next); |
|
193 | 183 | } |
194 | 184 | |
195 | 185 | /** |
@@ -201,8 +191,7 @@ discard block |
||
201 | 191 | protected static function regexp(string $pattern, RuleInterface $next = null): RuleInterface |
202 | 192 | { |
203 | 193 | return $next === null ? |
204 | - new StringRegExp($pattern) : |
|
205 | - new AndOperator(static::regexp($pattern), $next); |
|
194 | + new StringRegExp($pattern) : new AndOperator(static::regexp($pattern), $next); |
|
206 | 195 | } |
207 | 196 | |
208 | 197 | /** |