@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | if ($canSet) { |
46 | 46 | $this->assertFalse($adapter->offsetExists('fee')); |
47 | - $adapter->offsetSet('fee','nnn'); |
|
47 | + $adapter->offsetSet('fee', 'nnn'); |
|
48 | 48 | $this->assertTrue($adapter->offsetExists('fee')); |
49 | 49 | $adapter->offsetUnset('fee'); |
50 | 50 | $this->assertFalse($adapter->offsetExists('fee')); |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | 'xggxgx' => $entry, |
68 | 68 | ]; |
69 | 69 | return [ |
70 | - [new \Adapter(), '', true, true, true, true ], |
|
71 | - [new Adapters\ArrayAdapter($_GET), IEntry::SOURCE_GET, true, true, true, true ], |
|
72 | - [new Adapters\VarsAdapter(), IEntry::SOURCE_GET, true, false, true, true ], |
|
73 | - [new Adapters\VarsAdapter(), IEntry::SOURCE_POST, false, false, false, true ], |
|
74 | - [new Adapters\SessionAdapter(), '', false, false, false, true ], |
|
75 | - [new \Files(), '', false, false, false, false ], |
|
70 | + [new \Adapter(), '', true, true, true, true], |
|
71 | + [new Adapters\ArrayAdapter($_GET), IEntry::SOURCE_GET, true, true, true, true], |
|
72 | + [new Adapters\VarsAdapter(), IEntry::SOURCE_GET, true, false, true, true], |
|
73 | + [new Adapters\VarsAdapter(), IEntry::SOURCE_POST, false, false, false, true], |
|
74 | + [new Adapters\SessionAdapter(), '', false, false, false, true], |
|
75 | + [new \Files(), '', false, false, false, false], |
|
76 | 76 | ]; |
77 | 77 | } |
78 | 78 |
@@ -160,12 +160,12 @@ discard block |
||
160 | 160 | public function factoryProvider(): array |
161 | 161 | { |
162 | 162 | return [ |
163 | - [Controls\Security\Captcha\Factory::TYPE_DISABLED, '\kalanis\kw_forms\Controls\Security\Captcha\Disabled'], |
|
164 | - [Controls\Security\Captcha\Factory::TYPE_TEXT, '\kalanis\kw_forms\Controls\Security\Captcha\Text'], |
|
165 | - [Controls\Security\Captcha\Factory::TYPE_MATH, '\kalanis\kw_forms\Controls\Security\Captcha\Numerical'], |
|
166 | - [Controls\Security\Captcha\Factory::TYPE_COLOUR, '\kalanis\kw_forms\Controls\Security\Captcha\ColourfulText'], |
|
163 | + [Controls\Security\Captcha\Factory::TYPE_DISABLED, '\kalanis\kw_forms\Controls\Security\Captcha\Disabled'], |
|
164 | + [Controls\Security\Captcha\Factory::TYPE_TEXT, '\kalanis\kw_forms\Controls\Security\Captcha\Text'], |
|
165 | + [Controls\Security\Captcha\Factory::TYPE_MATH, '\kalanis\kw_forms\Controls\Security\Captcha\Numerical'], |
|
166 | + [Controls\Security\Captcha\Factory::TYPE_COLOUR, '\kalanis\kw_forms\Controls\Security\Captcha\ColourfulText'], |
|
167 | 167 | [Controls\Security\Captcha\Factory::TYPE_NOCAPTCHA, '\kalanis\kw_forms\Controls\Security\Captcha\Nocaptcha'], |
168 | - [123, '\kalanis\kw_forms\Controls\Security\Captcha\Text'], |
|
168 | + [123, '\kalanis\kw_forms\Controls\Security\Captcha\Text'], |
|
169 | 169 | ]; |
170 | 170 | } |
171 | 171 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | |
179 | 179 | class Graphical extends Controls\Security\Captcha\AGraphical |
180 | 180 | { |
181 | - public function set(string $alias, ArrayAccess &$session, string $errorMessage, string $font = ''): self |
|
181 | + public function set(string $alias, ArrayAccess & $session, string $errorMessage, string $font = ''): self |
|
182 | 182 | { |
183 | 183 | $this->font = $font; |
184 | 184 | $text = strtolower($this->generateRandomString(8)); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $input->set('myown', ['bar' => 'yep'], 'choose me', ['foo' => 'first', 'bar' => 'second', 'baz' => 'third', 'edd' => $extra]); |
31 | 31 | |
32 | 32 | $this->assertEquals( |
33 | - '<input type="checkbox" value="first" id="myown_foo" name="foo" /> <label for="myown_foo">first</label>' . PHP_EOL |
|
33 | + '<input type="checkbox" value="first" id="myown_foo" name="foo" /> <label for="myown_foo">first</label>' . PHP_EOL |
|
34 | 34 | . '<input type="checkbox" value="second" id="myown_bar" checked="checked" name="bar" /> <label for="myown_bar">second</label>' . PHP_EOL |
35 | 35 | . '<input type="checkbox" value="third" id="myown_baz" name="baz" /> <label for="myown_baz">third</label>' . PHP_EOL |
36 | 36 | . '<input type="checkbox" value="1" id="myown_edd" name="edd" /> <label for="myown_edd">fourth</label>' . PHP_EOL, $input->renderInput()); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $this->assertEmpty($values['bar']); |
40 | 40 | $this->assertEquals('third', $values['baz']); |
41 | 41 | $this->assertEquals( |
42 | - '<input type="checkbox" value="first" id="myown_foo" name="foo" /> <label for="myown_foo">first</label>' . PHP_EOL |
|
42 | + '<input type="checkbox" value="first" id="myown_foo" name="foo" /> <label for="myown_foo">first</label>' . PHP_EOL |
|
43 | 43 | . '<input type="checkbox" value="second" id="myown_bar" name="bar" /> <label for="myown_bar">second</label>' . PHP_EOL |
44 | 44 | . '<input type="checkbox" value="third" id="myown_baz" name="baz" checked="checked" /> <label for="myown_baz">third</label>' . PHP_EOL |
45 | 45 | . '<input type="checkbox" value="1" id="myown_edd" name="edd" /> <label for="myown_edd">fourth</label>' . PHP_EOL, $input->renderInput()); |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | $input->set('myown', 'bar', 'choose me', ['foo' => 'first', 'bar' => 'second', 'baz' => 'third', 'edd' => $extra]); |
67 | 67 | |
68 | 68 | $this->assertEquals( |
69 | - '<input type="radio" value="foo" id="myown_foo" name="myown" /> <label for="myown_foo">first</label>' . PHP_EOL |
|
69 | + '<input type="radio" value="foo" id="myown_foo" name="myown" /> <label for="myown_foo">first</label>' . PHP_EOL |
|
70 | 70 | . '<input type="radio" value="bar" checked="checked" id="myown_bar" name="myown" /> <label for="myown_bar">second</label>' . PHP_EOL |
71 | 71 | . '<input type="radio" value="baz" id="myown_baz" name="myown" /> <label for="myown_baz">third</label>' . PHP_EOL |
72 | 72 | . '<input type="radio" value="1" id="myown_1" name="myown" /> <label for="myown_1">fourth</label>', $input->renderInput()); |
73 | 73 | $input->setValue('baz'); |
74 | 74 | $this->assertEquals('baz', $input->getValue()); |
75 | 75 | $this->assertEquals( |
76 | - '<input type="radio" value="foo" id="myown_foo" name="myown" /> <label for="myown_foo">first</label>' . PHP_EOL |
|
76 | + '<input type="radio" value="foo" id="myown_foo" name="myown" /> <label for="myown_foo">first</label>' . PHP_EOL |
|
77 | 77 | . '<input type="radio" value="bar" id="myown_bar" name="myown" /> <label for="myown_bar">second</label>' . PHP_EOL |
78 | 78 | . '<input type="radio" value="baz" id="myown_baz" name="myown" checked="checked" /> <label for="myown_baz">third</label>' . PHP_EOL |
79 | 79 | . '<input type="radio" value="1" id="myown_1" name="myown" /> <label for="myown_1">fourth</label>', $input->renderInput()); |
@@ -27,7 +27,7 @@ |
||
27 | 27 | $input->resetUniq(); |
28 | 28 | $input->set('myown', 'original', 'not to look'); |
29 | 29 | $this->assertEquals( |
30 | - ' <input type="text" value="" class="datepicker" id="myown_0" name="myown[]" /> '. PHP_EOL |
|
30 | + ' <input type="text" value="" class="datepicker" id="myown_0" name="myown[]" /> '. PHP_EOL |
|
31 | 31 | . ' <input type="text" value="" class="datepicker" id="myown_1" name="myown[]" /> ', $input->renderInput()); |
32 | 32 | } |
33 | 33 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | $input->resetUniq(); |
28 | 28 | $input->set('myown', 'original', 'not to look'); |
29 | 29 | $this->assertEquals( |
30 | - ' <input type="text" value="" class="datepicker" id="myown_0" name="myown[]" /> '. PHP_EOL |
|
30 | + ' <input type="text" value="" class="datepicker" id="myown_0" name="myown[]" /> ' . PHP_EOL |
|
31 | 31 | . ' <input type="text" value="" class="datepicker" id="myown_1" name="myown[]" /> ', $input->renderInput()); |
32 | 32 | } |
33 | 33 | } |
@@ -33,14 +33,14 @@ discard block |
||
33 | 33 | |
34 | 34 | $this->assertEmpty($input->renderErrors([])); |
35 | 35 | $this->assertEquals( |
36 | - '<optgroup label="choose me"> <option value="foo">first</option> ' . PHP_EOL |
|
36 | + '<optgroup label="choose me"> <option value="foo">first</option> ' . PHP_EOL |
|
37 | 37 | . ' <option value="bar">second</option> ' . PHP_EOL |
38 | 38 | . ' <option value="baz">third</option> ' . PHP_EOL |
39 | 39 | . ' <option value="1">fourth</option> </optgroup>', $input->renderInput()); |
40 | 40 | $input->setValue('baz'); |
41 | 41 | $this->assertEquals('baz', $input->getValue()); |
42 | 42 | $this->assertEquals( |
43 | - '<optgroup label="choose me"> <option value="foo">first</option> ' . PHP_EOL |
|
43 | + '<optgroup label="choose me"> <option value="foo">first</option> ' . PHP_EOL |
|
44 | 44 | . ' <option value="bar">second</option> ' . PHP_EOL |
45 | 45 | . ' <option value="baz" selected="selected">third</option> ' . PHP_EOL |
46 | 46 | . ' <option value="1">fourth</option> </optgroup>', $input->renderInput()); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | $this->assertEquals('', $input->getValue()); |
73 | 73 | $this->assertEquals( |
74 | - '<select id="myown" name="myown"> <optgroup label="choose me"> <option value="foo">first</option> ' . PHP_EOL |
|
74 | + '<select id="myown" name="myown"> <optgroup label="choose me"> <option value="foo">first</option> ' . PHP_EOL |
|
75 | 75 | . ' <option value="bar">second</option> ' . PHP_EOL |
76 | 76 | . ' <option value="baz">third</option> </optgroup> ' . PHP_EOL |
77 | 77 | . ' <optgroup label="choose another"> <option value="fss">fifth</option> ' . PHP_EOL |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $input->setValue('dfg'); |
82 | 82 | $this->assertEquals('dfg', $input->getValue()); |
83 | 83 | $this->assertEquals( |
84 | - '<select id="myown" name="myown"> <optgroup label="choose me"> <option value="foo">first</option> ' . PHP_EOL |
|
84 | + '<select id="myown" name="myown"> <optgroup label="choose me"> <option value="foo">first</option> ' . PHP_EOL |
|
85 | 85 | . ' <option value="bar">second</option> ' . PHP_EOL |
86 | 86 | . ' <option value="baz">third</option> </optgroup> ' . PHP_EOL |
87 | 87 | . ' <optgroup label="choose another"> <option value="fss">fifth</option> ' . PHP_EOL |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $input->setValue('1'); |
92 | 92 | $this->assertEquals('1', $input->getValue()); |
93 | 93 | $this->assertEquals( |
94 | - '<select id="myown" name="myown"> <optgroup label="choose me"> <option value="foo">first</option> ' . PHP_EOL |
|
94 | + '<select id="myown" name="myown"> <optgroup label="choose me"> <option value="foo">first</option> ' . PHP_EOL |
|
95 | 95 | . ' <option value="bar">second</option> ' . PHP_EOL |
96 | 96 | . ' <option value="baz">third</option> </optgroup> ' . PHP_EOL |
97 | 97 | . ' <optgroup label="choose another"> <option value="fss">fifth</option> ' . PHP_EOL |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $input = new Controls\Files(); |
26 | 26 | $input->set('myown', ['one', 'two'], 'Upload files'); |
27 | 27 | $this->assertEquals( |
28 | - '<label for="myown_0">one</label> <input type="file" id="myown_0" name="myown[]" /> ' . PHP_EOL |
|
28 | + '<label for="myown_0">one</label> <input type="file" id="myown_0" name="myown[]" /> ' . PHP_EOL |
|
29 | 29 | . '<label for="myown_1">two</label> <input type="file" id="myown_1" name="myown[]" /> ' . PHP_EOL, $input->renderInput()); |
30 | 30 | } |
31 | 31 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $input = new Controls\Files(); |
35 | 35 | $input->set('myown', ['foo' => 'one', 'bar' => 'two'], 'Upload files'); |
36 | 36 | $this->assertEquals( |
37 | - '<label for="myown_0">one</label> <input type="file" id="myown_0" name="myown[foo]" /> ' . PHP_EOL |
|
37 | + '<label for="myown_0">one</label> <input type="file" id="myown_0" name="myown[foo]" /> ' . PHP_EOL |
|
38 | 38 | . '<label for="myown_1">two</label> <input type="file" id="myown_1" name="myown[bar]" /> ' . PHP_EOL, $input->renderInput()); |
39 | 39 | } |
40 | 40 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | $this->assertNotEmpty($input->getValues()); |
52 | 52 | $this->assertEquals( |
53 | - '<label for="download_0">one</label> <input type="file" id="download_0" name="download[file1]" /> ' . PHP_EOL |
|
53 | + '<label for="download_0">one</label> <input type="file" id="download_0" name="download[file1]" /> ' . PHP_EOL |
|
54 | 54 | . '<label for="download_1">two</label> <input type="file" id="download_1" name="download[file2]" /> ' . PHP_EOL, $input->renderInput()); |
55 | 55 | } |
56 | 56 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $input->setValues(iterator_to_array($adapter)); |
66 | 66 | |
67 | 67 | $this->assertEquals( |
68 | - '<label for="numbered_0">one</label> <input type="file" id="numbered_0" name="numbered[]" /> ' . PHP_EOL |
|
68 | + '<label for="numbered_0">one</label> <input type="file" id="numbered_0" name="numbered[]" /> ' . PHP_EOL |
|
69 | 69 | . '<label for="numbered_1">two</label> <input type="file" id="numbered_1" name="numbered[]" /> ' . PHP_EOL, $input->renderInput()); |
70 | 70 | } |
71 | 71 |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | public function load(string $key) |
41 | 41 | { |
42 | - return isset($this->content[$key]) ? $this->content[$key] : null ; |
|
42 | + return isset($this->content[$key]) ? $this->content[$key] : null; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | public function save(string $key, $data, ?int $timeout = null): bool |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | public function current() |
95 | 95 | { |
96 | - return $this->valid() ? $this->offsetGet($this->key) : null ; |
|
96 | + return $this->valid() ? $this->offsetGet($this->key) : null; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | public function next() |
@@ -184,14 +184,14 @@ discard block |
||
184 | 184 | protected function fileDataset(): array |
185 | 185 | { |
186 | 186 | return [ |
187 | - 'files' => [ // simple upload |
|
187 | + 'files' => [// simple upload |
|
188 | 188 | 'name' => 'facepalm.jpg', |
189 | 189 | 'type' => 'image/jpeg', |
190 | 190 | 'tmp_name' => '/tmp/php3zU3t5', |
191 | 191 | 'error' => UPLOAD_ERR_OK, |
192 | 192 | 'size' => 591387, |
193 | 193 | ], |
194 | - 'download' => [ // multiple upload |
|
194 | + 'download' => [// multiple upload |
|
195 | 195 | 'name' => [ |
196 | 196 | 'file1' => 'MyFile.txt', |
197 | 197 | 'file2' => 'MyFile.jpg', |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | 'file2' => 3075, |
214 | 214 | ], |
215 | 215 | ], |
216 | - 'numbered' => [ // multiple upload |
|
216 | + 'numbered' => [// multiple upload |
|
217 | 217 | 'name' => [ |
218 | 218 | 0 => 'MyFile.txt', |
219 | 219 | 1 => 'MyFile.jpg', |
@@ -50,7 +50,9 @@ |
||
50 | 50 | |
51 | 51 | public function remove(string $key): bool |
52 | 52 | { |
53 | - if (isset($this->content[$key])) unset($this->content[$key]); |
|
53 | + if (isset($this->content[$key])) { |
|
54 | + unset($this->content[$key]); |
|
55 | + } |
|
54 | 56 | return true; |
55 | 57 | } |
56 | 58 |
@@ -39,7 +39,7 @@ |
||
39 | 39 | #[\ReturnTypeWillChange] |
40 | 40 | public function current() |
41 | 41 | { |
42 | - return $this->valid() ? $this->offsetGet($this->key) : null ; |
|
42 | + return $this->valid() ? $this->offsetGet($this->key) : null; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | public function next(): void |
@@ -17,7 +17,7 @@ |
||
17 | 17 | * @param ArrayAccess $cookie |
18 | 18 | * @param int $expire |
19 | 19 | */ |
20 | - public function init(ArrayAccess &$cookie, int $expire = 3600): void; |
|
20 | + public function init(ArrayAccess & $cookie, int $expire = 3600): void; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Remove known token |