@@ -91,11 +91,11 @@ |
||
91 | 91 | return [ |
92 | 92 | ['5', '7', true, false], |
93 | 93 | [[new \stdClass()], '7', true, false], |
94 | - [[1,3,5,9], '7', false, false], |
|
95 | - [[1,3,5,9], '5', false, true], |
|
96 | - [['2','4','6','8'], 6, false, true], |
|
97 | - [['abc','def','ghi','jkl'], 'mno', false, false], |
|
98 | - [['abc','def','ghi','jkl'], 'def', false, true], |
|
94 | + [[1, 3, 5, 9], '7', false, false], |
|
95 | + [[1, 3, 5, 9], '5', false, true], |
|
96 | + [['2', '4', '6', '8'], 6, false, true], |
|
97 | + [['abc', 'def', 'ghi', 'jkl'], 'mno', false, false], |
|
98 | + [['abc', 'def', 'ghi', 'jkl'], 'def', false, true], |
|
99 | 99 | ]; |
100 | 100 | } |
101 | 101 |
@@ -22,7 +22,9 @@ discard block |
||
22 | 22 | $this->assertInstanceOf(Rules\ARule::class, $data); |
23 | 23 | |
24 | 24 | $mock = MockEntry::init($key, $checkValue); |
25 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
25 | + if (!$gotResult) { |
|
26 | + $this->expectException(RuleException::class); |
|
27 | + } |
|
26 | 28 | $data->validate($mock); |
27 | 29 | } |
28 | 30 | |
@@ -40,7 +42,9 @@ discard block |
||
40 | 42 | $data->setAgainstValue($expectedValue); |
41 | 43 | $this->assertInstanceOf(Rules\ARule::class, $data); |
42 | 44 | $mock = MockEntry::init($key, $checkValue); |
43 | - if ($gotResult) $this->expectException(RuleException::class); |
|
45 | + if ($gotResult) { |
|
46 | + $this->expectException(RuleException::class); |
|
47 | + } |
|
44 | 48 | $data->validate($mock); |
45 | 49 | } |
46 | 50 | |
@@ -56,11 +60,15 @@ discard block |
||
56 | 60 | { |
57 | 61 | $data = new Rules\IsInArray(); |
58 | 62 | $this->assertInstanceOf(Rules\ARule::class, $data); |
59 | - if ($gotError) $this->expectException(RuleException::class); |
|
63 | + if ($gotError) { |
|
64 | + $this->expectException(RuleException::class); |
|
65 | + } |
|
60 | 66 | $data->setAgainstValue($expectedValues); |
61 | 67 | if (!$gotError) { |
62 | 68 | $mock = MockEntry::init('foo', $checkValue); |
63 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
69 | + if (!$gotResult) { |
|
70 | + $this->expectException(RuleException::class); |
|
71 | + } |
|
64 | 72 | $data->validate($mock); |
65 | 73 | } |
66 | 74 | } |
@@ -77,11 +85,15 @@ discard block |
||
77 | 85 | { |
78 | 86 | $data = new Rules\IsNotInArray(); |
79 | 87 | $this->assertInstanceOf(Rules\ARule::class, $data); |
80 | - if ($gotError) $this->expectException(RuleException::class); |
|
88 | + if ($gotError) { |
|
89 | + $this->expectException(RuleException::class); |
|
90 | + } |
|
81 | 91 | $data->setAgainstValue($expectedValues); |
82 | 92 | if (!$gotError) { |
83 | 93 | $mock = MockEntry::init('foo', $checkValue); |
84 | - if ($gotResult) $this->expectException(RuleException::class); |
|
94 | + if ($gotResult) { |
|
95 | + $this->expectException(RuleException::class); |
|
96 | + } |
|
85 | 97 | $data->validate($mock); |
86 | 98 | } |
87 | 99 | } |
@@ -112,7 +124,9 @@ discard block |
||
112 | 124 | $data->setAgainstValue($expectedValue); |
113 | 125 | $this->assertInstanceOf(Rules\ARule::class, $data); |
114 | 126 | $mock = MockEntry::init('foo', $checkValue); |
115 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
127 | + if (!$gotResult) { |
|
128 | + $this->expectException(RuleException::class); |
|
129 | + } |
|
116 | 130 | $data->validate($mock); |
117 | 131 | } |
118 | 132 | |
@@ -129,7 +143,9 @@ discard block |
||
129 | 143 | $data->setAgainstValue($expectedValue); |
130 | 144 | $this->assertInstanceOf(Rules\ARule::class, $data); |
131 | 145 | $mock = MockEntry::init('foo', $checkValue); |
132 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
146 | + if (!$gotResult) { |
|
147 | + $this->expectException(RuleException::class); |
|
148 | + } |
|
133 | 149 | $data->validate($mock); |
134 | 150 | } |
135 | 151 | |
@@ -146,7 +162,9 @@ discard block |
||
146 | 162 | $data->setAgainstValue($expectedValue); |
147 | 163 | $this->assertInstanceOf(Rules\ARule::class, $data); |
148 | 164 | $mock = MockEntry::init('foo', $checkValue); |
149 | - if ($gotResult) $this->expectException(RuleException::class); |
|
165 | + if ($gotResult) { |
|
166 | + $this->expectException(RuleException::class); |
|
167 | + } |
|
150 | 168 | $data->validate($mock); |
151 | 169 | } |
152 | 170 | |
@@ -163,7 +181,9 @@ discard block |
||
163 | 181 | $data->setAgainstValue($expectedValue); |
164 | 182 | $this->assertInstanceOf(Rules\ARule::class, $data); |
165 | 183 | $mock = MockEntry::init('foo', $checkValue); |
166 | - if ($gotResult) $this->expectException(RuleException::class); |
|
184 | + if ($gotResult) { |
|
185 | + $this->expectException(RuleException::class); |
|
186 | + } |
|
167 | 187 | $data->validate($mock); |
168 | 188 | } |
169 | 189 | |
@@ -211,7 +231,9 @@ discard block |
||
211 | 231 | $data = new Rules\IsEmpty(); |
212 | 232 | $this->assertInstanceOf(Rules\ARule::class, $data); |
213 | 233 | $mock = MockEntry::init('foo', $checkValue); |
214 | - if ($gotResult) $this->expectException(RuleException::class); |
|
234 | + if ($gotResult) { |
|
235 | + $this->expectException(RuleException::class); |
|
236 | + } |
|
215 | 237 | $data->validate($mock); |
216 | 238 | } |
217 | 239 | |
@@ -226,7 +248,9 @@ discard block |
||
226 | 248 | $data = new Rules\IsFilled(); |
227 | 249 | $this->assertInstanceOf(Rules\ARule::class, $data); |
228 | 250 | $mock = MockEntry::init('foo', $checkValue); |
229 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
251 | + if (!$gotResult) { |
|
252 | + $this->expectException(RuleException::class); |
|
253 | + } |
|
230 | 254 | $data->validate($mock); |
231 | 255 | } |
232 | 256 | |
@@ -252,7 +276,9 @@ discard block |
||
252 | 276 | $data = new Rules\IsJsonString(); |
253 | 277 | $this->assertInstanceOf(Rules\ARule::class, $data); |
254 | 278 | $mock = MockEntry::init('foo', $checkValue); |
255 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
279 | + if (!$gotResult) { |
|
280 | + $this->expectException(RuleException::class); |
|
281 | + } |
|
256 | 282 | $data->validate($mock); |
257 | 283 | } |
258 | 284 |
@@ -80,7 +80,9 @@ |
||
80 | 80 | $data->setAgainstValue($maxSize); |
81 | 81 | $mock = MockFile::init('foo', 'text0.txt', 'text/plain', |
82 | 82 | '', $fileSize, UPLOAD_ERR_OK ); |
83 | - if (!$match) $this->expectException(RuleException::class); |
|
83 | + if (!$match) { |
|
84 | + $this->expectException(RuleException::class); |
|
85 | + } |
|
84 | 86 | $data->validate($mock); |
85 | 87 | } |
86 | 88 |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $this->assertInstanceOf(File\AFileRule::class, $data); |
80 | 80 | $data->setAgainstValue($maxSize); |
81 | 81 | $mock = MockFile::init('foo', 'text0.txt', 'text/plain', |
82 | - '', $fileSize, UPLOAD_ERR_OK ); |
|
82 | + '', $fileSize, UPLOAD_ERR_OK); |
|
83 | 83 | if (!$match) $this->expectException(RuleException::class); |
84 | 84 | $data->validate($mock); |
85 | 85 | } |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | public function sizeMatchProvider(): array |
88 | 88 | { |
89 | 89 | return [ |
90 | - ['32', 128, false], |
|
90 | + ['32', 128, false], |
|
91 | 91 | ['10g', 46843, true], |
92 | 92 | ['15m', 84641, true], |
93 | - ['30k', 3534, true], |
|
93 | + ['30k', 3534, true], |
|
94 | 94 | ['30k', 35534, false], |
95 | 95 | ]; |
96 | 96 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | [123, '', false, false], |
36 | 36 | ['asdf', '', false, false], |
37 | 37 | ['CallbackRulesTest::callMeStatic', null, true, false], |
38 | - ['CallbackRulesTest::callMeStatic', 1, true, true ], |
|
38 | + ['CallbackRulesTest::callMeStatic', 1, true, true], |
|
39 | 39 | [[$this, 'callMeDynamic'], null, true, false], |
40 | 40 | [[$this, 'callMeDynamic'], 1, true, true], |
41 | 41 | ]; |
@@ -18,11 +18,15 @@ |
||
18 | 18 | { |
19 | 19 | $data = new Rules\ProcessCallback(); |
20 | 20 | $this->assertInstanceOf(Rules\ARule::class, $data); |
21 | - if (!$gotResult) $this->expectException(RuleException::class); |
|
21 | + if (!$gotResult) { |
|
22 | + $this->expectException(RuleException::class); |
|
23 | + } |
|
22 | 24 | $data->setAgainstValue($expectedCall); |
23 | 25 | if ($gotResult) { |
24 | 26 | $mock = MockEntry::init('foo', $checkValue); |
25 | - if (!$pass) $this->expectException(RuleException::class); |
|
27 | + if (!$pass) { |
|
28 | + $this->expectException(RuleException::class); |
|
29 | + } |
|
26 | 30 | $data->validate($mock); |
27 | 31 | } |
28 | 32 | } |
@@ -20,20 +20,20 @@ |
||
20 | 20 | { |
21 | 21 | return MockFile::init('foo', 'test1.gif', 'text/plain', |
22 | 22 | realpath(implode(DIRECTORY_SEPARATOR, [__DIR__, 'data', 'tester.gif'])), |
23 | - 55, UPLOAD_ERR_OK ); |
|
23 | + 55, UPLOAD_ERR_OK); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | protected function getMockFile() |
27 | 27 | { |
28 | 28 | return MockFile::init('foo', 'text1.txt', 'text/plain', |
29 | 29 | realpath(implode(DIRECTORY_SEPARATOR, [__DIR__, 'data', 'testing.1.txt'])), |
30 | - 13, UPLOAD_ERR_OK ); |
|
30 | + 13, UPLOAD_ERR_OK); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | protected function getMockNoFile() |
34 | 34 | { |
35 | 35 | return MockFile::init('foo', 'text0.txt', 'text/plain', |
36 | - '', 26, UPLOAD_ERR_NO_FILE ); |
|
36 | + '', 26, UPLOAD_ERR_NO_FILE); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 |
@@ -18,7 +18,7 @@ |
||
18 | 18 | public function validate(IValidate $entry): void |
19 | 19 | { |
20 | 20 | $headers = @get_headers(strval($entry->getValue())); |
21 | - if (!empty($headers) && (false !== mb_strpos($headers[0], '200') )) { |
|
21 | + if (!empty($headers) && (false !== mb_strpos($headers[0], '200'))) { |
|
22 | 22 | return; |
23 | 23 | } |
24 | 24 | throw new RuleException(sprintf($this->errorText, $entry->getKey())); |
@@ -38,7 +38,7 @@ |
||
38 | 38 | if (!is_object($singleRule)) { |
39 | 39 | throw new RuleException('Input is not an object.'); |
40 | 40 | } |
41 | - if (! ( ($singleRule instanceof ARule) || ($singleRule instanceof File\AFileRule) ) ) { |
|
41 | + if (!(($singleRule instanceof ARule) || ($singleRule instanceof File\AFileRule))) { |
|
42 | 42 | throw new RuleException(sprintf('Input %s is not instance of ARule or AFileRule.', get_class($singleRule))); |
43 | 43 | } |
44 | 44 | return $singleRule; |
@@ -18,7 +18,7 @@ |
||
18 | 18 | { |
19 | 19 | public function validate(IValidate $entry): void |
20 | 20 | { |
21 | - if (!password_verify( strval($entry->getValue()), strval($this->againstValue) )) { |
|
21 | + if (!password_verify(strval($entry->getValue()), strval($this->againstValue))) { |
|
22 | 22 | throw new RuleException($this->errorText); |
23 | 23 | } |
24 | 24 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | { |
18 | 18 | public function validate(IValidate $entry): void |
19 | 19 | { |
20 | - if (!hash_equals( strval($this->againstValue), strval($entry->getValue()) )) { |
|
20 | + if (!hash_equals(strval($this->againstValue), strval($entry->getValue()))) { |
|
21 | 21 | throw new RuleException($this->errorText); |
22 | 22 | } |
23 | 23 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | if (!is_object($againstValue)) { |
27 | 27 | throw new RuleException('Input is not an object.'); |
28 | 28 | } |
29 | - if (! ($againstValue instanceof IValidate) ) { |
|
29 | + if (!($againstValue instanceof IValidate)) { |
|
30 | 30 | throw new RuleException(sprintf('Input %s is not instance of IValidate.', get_class($againstValue))); |
31 | 31 | } |
32 | 32 | return $againstValue; |