@@ -32,8 +32,8 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | public function isMet(ValidatorInterface $validator, string $field, $value): bool |
| 34 | 34 | { |
| 35 | - foreach ($this->compositor->makeConditions($field, $this->options) as $condition) { |
|
| 36 | - if ($condition->isMet($validator, $field, $value)) { |
|
| 35 | + foreach ($this->compositor->makeConditions($field, $this->options) as $condition){ |
|
| 36 | + if ($condition->isMet($validator, $field, $value)){ |
|
| 37 | 37 | return false; |
| 38 | 38 | } |
| 39 | 39 | } |
@@ -32,8 +32,10 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | public function isMet(ValidatorInterface $validator, string $field, $value): bool |
| 34 | 34 | { |
| 35 | - foreach ($this->compositor->makeConditions($field, $this->options) as $condition) { |
|
| 36 | - if ($condition->isMet($validator, $field, $value)) { |
|
| 35 | + foreach ($this->compositor->makeConditions($field, $this->options) as $condition) |
|
| 36 | + { |
|
| 37 | + if ($condition->isMet($validator, $field, $value)) |
|
| 38 | + { |
|
| 37 | 39 | return false; |
| 38 | 40 | } |
| 39 | 41 | } |
@@ -27,8 +27,8 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public function isMet(ValidatorInterface $validator, string $field, $value): bool |
| 29 | 29 | { |
| 30 | - foreach ($this->options as $option) { |
|
| 31 | - if (!empty($validator->getValue($option))) { |
|
| 30 | + foreach ($this->options as $option){ |
|
| 31 | + if (!empty($validator->getValue($option))){ |
|
| 32 | 32 | return false; |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -27,8 +27,10 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public function isMet(ValidatorInterface $validator, string $field, $value): bool |
| 29 | 29 | { |
| 30 | - foreach ($this->options as $option) { |
|
| 31 | - if (!empty($validator->getValue($option))) { |
|
| 30 | + foreach ($this->options as $option) |
|
| 31 | + { |
|
| 32 | + if (!empty($validator->getValue($option))) |
|
| 33 | + { |
|
| 32 | 34 | return false; |
| 33 | 35 | } |
| 34 | 36 | } |
@@ -27,8 +27,8 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public function isMet(ValidatorInterface $validator, string $field, $value): bool |
| 29 | 29 | { |
| 30 | - foreach ($this->options as $option) { |
|
| 31 | - if (empty($validator->getValue($option))) { |
|
| 30 | + foreach ($this->options as $option){ |
|
| 31 | + if (empty($validator->getValue($option))){ |
|
| 32 | 32 | return false; |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -27,8 +27,10 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public function isMet(ValidatorInterface $validator, string $field, $value): bool |
| 29 | 29 | { |
| 30 | - foreach ($this->options as $option) { |
|
| 31 | - if (empty($validator->getValue($option))) { |
|
| 30 | + foreach ($this->options as $option) |
|
| 31 | + { |
|
| 32 | + if (empty($validator->getValue($option))) |
|
| 33 | + { |
|
| 32 | 34 | return false; |
| 33 | 35 | } |
| 34 | 36 | } |
@@ -27,8 +27,8 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public function isMet(ValidatorInterface $validator, string $field, $value): bool |
| 29 | 29 | { |
| 30 | - foreach ($this->options as $option) { |
|
| 31 | - if (!$validator->hasValue($option)) { |
|
| 30 | + foreach ($this->options as $option){ |
|
| 31 | + if (!$validator->hasValue($option)){ |
|
| 32 | 32 | return false; |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -27,8 +27,10 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public function isMet(ValidatorInterface $validator, string $field, $value): bool |
| 29 | 29 | { |
| 30 | - foreach ($this->options as $option) { |
|
| 31 | - if (!$validator->hasValue($option)) { |
|
| 30 | + foreach ($this->options as $option) |
|
| 31 | + { |
|
| 32 | + if (!$validator->hasValue($option)) |
|
| 33 | + { |
|
| 32 | 34 | return false; |
| 33 | 35 | } |
| 34 | 36 | } |
@@ -32,12 +32,12 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | public function isMet(ValidatorInterface $validator, string $field, $value): bool |
| 34 | 34 | { |
| 35 | - if (empty($this->options)) { |
|
| 35 | + if (empty($this->options)){ |
|
| 36 | 36 | return true; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - foreach ($this->compositor->makeConditions($field, $this->options) as $condition) { |
|
| 40 | - if ($condition->isMet($validator, $field, $value)) { |
|
| 39 | + foreach ($this->compositor->makeConditions($field, $this->options) as $condition){ |
|
| 40 | + if ($condition->isMet($validator, $field, $value)){ |
|
| 41 | 41 | return true; |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -32,12 +32,15 @@ |
||
| 32 | 32 | */ |
| 33 | 33 | public function isMet(ValidatorInterface $validator, string $field, $value): bool |
| 34 | 34 | { |
| 35 | - if (empty($this->options)) { |
|
| 35 | + if (empty($this->options)) |
|
| 36 | + { |
|
| 36 | 37 | return true; |
| 37 | 38 | } |
| 38 | 39 | |
| 39 | - foreach ($this->compositor->makeConditions($field, $this->options) as $condition) { |
|
| 40 | - if ($condition->isMet($validator, $field, $value)) { |
|
| 40 | + foreach ($this->compositor->makeConditions($field, $this->options) as $condition) |
|
| 41 | + { |
|
| 42 | + if ($condition->isMet($validator, $field, $value)) |
|
| 43 | + { |
|
| 41 | 44 | return true; |
| 42 | 45 | } |
| 43 | 46 | } |
@@ -27,8 +27,8 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public function isMet(ValidatorInterface $validator, string $field, $value): bool |
| 29 | 29 | { |
| 30 | - foreach ($this->options as $option) { |
|
| 31 | - if (!empty($validator->getValue($option))) { |
|
| 30 | + foreach ($this->options as $option){ |
|
| 31 | + if (!empty($validator->getValue($option))){ |
|
| 32 | 32 | return true; |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -27,8 +27,10 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public function isMet(ValidatorInterface $validator, string $field, $value): bool |
| 29 | 29 | { |
| 30 | - foreach ($this->options as $option) { |
|
| 31 | - if (!empty($validator->getValue($option))) { |
|
| 30 | + foreach ($this->options as $option) |
|
| 31 | + { |
|
| 32 | + if (!empty($validator->getValue($option))) |
|
| 33 | + { |
|
| 32 | 34 | return true; |
| 33 | 35 | } |
| 34 | 36 | } |
@@ -27,8 +27,8 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public function isMet(ValidatorInterface $validator, string $field, $value): bool |
| 29 | 29 | { |
| 30 | - foreach ($this->options as $option) { |
|
| 31 | - if ($validator->hasValue($option)) { |
|
| 30 | + foreach ($this->options as $option){ |
|
| 31 | + if ($validator->hasValue($option)){ |
|
| 32 | 32 | return false; |
| 33 | 33 | } |
| 34 | 34 | } |
@@ -27,8 +27,10 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public function isMet(ValidatorInterface $validator, string $field, $value): bool |
| 29 | 29 | { |
| 30 | - foreach ($this->options as $option) { |
|
| 31 | - if ($validator->hasValue($option)) { |
|
| 30 | + foreach ($this->options as $option) |
|
| 31 | + { |
|
| 32 | + if ($validator->hasValue($option)) |
|
| 33 | + { |
|
| 32 | 34 | return false; |
| 33 | 35 | } |
| 34 | 36 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function ignoreEmpty(string $method, $value, array $args): bool |
| 39 | 39 | { |
| 40 | - if (!empty($value)) { |
|
| 40 | + if (!empty($value)){ |
|
| 41 | 41 | return false; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -54,12 +54,12 @@ discard block |
||
| 54 | 54 | $value, |
| 55 | 55 | array $args = [] |
| 56 | 56 | ): bool { |
| 57 | - try { |
|
| 57 | + try{ |
|
| 58 | 58 | $this->validator = $v; |
| 59 | 59 | array_unshift($args, $value); |
| 60 | 60 | |
| 61 | 61 | return call_user_func_array([$this, $method], $args); |
| 62 | - } finally { |
|
| 62 | + }finally{ |
|
| 63 | 63 | $this->validator = null; |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | public function getMessage(string $method, string $field, $value, array $arguments = []): string |
| 71 | 71 | { |
| 72 | 72 | $messages = static::MESSAGES; |
| 73 | - if (isset($messages[$method])) { |
|
| 73 | + if (isset($messages[$method])){ |
|
| 74 | 74 | array_unshift($arguments, $field); |
| 75 | 75 | |
| 76 | 76 | return $this->say(static::MESSAGES[$method], $arguments); |
@@ -37,7 +37,8 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function ignoreEmpty(string $method, $value, array $args): bool |
| 39 | 39 | { |
| 40 | - if (!empty($value)) { |
|
| 40 | + if (!empty($value)) |
|
| 41 | + { |
|
| 41 | 42 | return false; |
| 42 | 43 | } |
| 43 | 44 | |
@@ -54,12 +55,15 @@ discard block |
||
| 54 | 55 | $value, |
| 55 | 56 | array $args = [] |
| 56 | 57 | ): bool { |
| 57 | - try { |
|
| 58 | + try |
|
| 59 | + { |
|
| 58 | 60 | $this->validator = $v; |
| 59 | 61 | array_unshift($args, $value); |
| 60 | 62 | |
| 61 | 63 | return call_user_func_array([$this, $method], $args); |
| 62 | - } finally { |
|
| 64 | + } |
|
| 65 | + finally |
|
| 66 | + { |
|
| 63 | 67 | $this->validator = null; |
| 64 | 68 | } |
| 65 | 69 | } |
@@ -70,7 +74,8 @@ discard block |
||
| 70 | 74 | public function getMessage(string $method, string $field, $value, array $arguments = []): string |
| 71 | 75 | { |
| 72 | 76 | $messages = static::MESSAGES; |
| 73 | - if (isset($messages[$method])) { |
|
| 77 | + if (isset($messages[$method])) |
|
| 78 | + { |
|
| 74 | 79 | array_unshift($arguments, $field); |
| 75 | 80 | |
| 76 | 81 | return $this->say(static::MESSAGES[$method], $arguments); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | public function testWithAny(): void |
| 81 | 81 | { |
| 82 | 82 | $this->assertValid( |
| 83 | - ['i' => 'a',], |
|
| 83 | + ['i' => 'a', ], |
|
| 84 | 84 | ['i' => [['is_bool', 'if' => ['withAny' => ['b', 'c']]]]] |
| 85 | 85 | ); |
| 86 | 86 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | public function testWithAll(): void |
| 101 | 101 | { |
| 102 | 102 | $this->assertValid( |
| 103 | - ['i' => 'a',], |
|
| 103 | + ['i' => 'a', ], |
|
| 104 | 104 | ['i' => [['is_bool', 'if' => ['withAll' => ['b', 'c']]]]] |
| 105 | 105 | ); |
| 106 | 106 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | $this->assertNotValid( |
| 122 | 122 | 'i', |
| 123 | - ['i' => 'a',], |
|
| 123 | + ['i' => 'a', ], |
|
| 124 | 124 | ['i' => [['is_bool', 'if' => ['withoutAny' => ['b', 'c']]]]] |
| 125 | 125 | ); |
| 126 | 126 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | { |
| 141 | 141 | $this->assertNotValid( |
| 142 | 142 | 'i', |
| 143 | - ['i' => 'a',], |
|
| 143 | + ['i' => 'a', ], |
|
| 144 | 144 | ['i' => [['is_bool', 'if' => ['withoutAll' => ['b', 'c']]]]] |
| 145 | 145 | ); |
| 146 | 146 | |