@@ -52,6 +52,9 @@ discard block |
||
52 | 52 | return current($this->objects); |
53 | 53 | } |
54 | 54 | |
55 | + /** |
|
56 | + * @param integer $key |
|
57 | + */ |
|
55 | 58 | public function remove($key) |
56 | 59 | { |
57 | 60 | if (!isset($this->objects[$key]) && !array_key_exists($key, $this->objects)) { |
@@ -82,6 +85,9 @@ discard block |
||
82 | 85 | return in_array($element, $this->objects, true); |
83 | 86 | } |
84 | 87 | |
88 | + /** |
|
89 | + * @param integer $key |
|
90 | + */ |
|
85 | 91 | public function get($key) |
86 | 92 | { |
87 | 93 | return $this->objects[$key] ?? null; |
@@ -102,11 +108,18 @@ discard block |
||
102 | 108 | return count($this->objects); |
103 | 109 | } |
104 | 110 | |
111 | + /** |
|
112 | + * @param integer $key |
|
113 | + * @param \PhpValueObjects\Tests\Collection\ObjectForTest $value |
|
114 | + */ |
|
105 | 115 | public function set($key, $value): void |
106 | 116 | { |
107 | 117 | $this->objects[$key] = $value; |
108 | 118 | } |
109 | 119 | |
120 | + /** |
|
121 | + * @param \PhpValueObjects\Tests\Collection\ObjectForTest $element |
|
122 | + */ |
|
110 | 123 | public function add($element): void |
111 | 124 | { |
112 | 125 | $this->objects[] = $element; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | public static function init(): self |
24 | 24 | { |
25 | - return new static([]); |
|
25 | + return new static([ ]); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | abstract protected function setClassName(): string; |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | |
60 | 60 | public function remove($key) |
61 | 61 | { |
62 | - if (!isset($this->objects[$key]) && !array_key_exists($key, $this->objects)) { |
|
62 | + if (!isset($this->objects[ $key ]) && !array_key_exists($key, $this->objects)) { |
|
63 | 63 | return null; |
64 | 64 | } |
65 | 65 | |
66 | - $removed = $this->objects[$key]; |
|
67 | - unset($this->objects[$key]); |
|
66 | + $removed = $this->objects[ $key ]; |
|
67 | + unset($this->objects[ $key ]); |
|
68 | 68 | |
69 | 69 | return $removed; |
70 | 70 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | return false; |
78 | 78 | } |
79 | 79 | |
80 | - unset($this->objects[$key]); |
|
80 | + unset($this->objects[ $key ]); |
|
81 | 81 | |
82 | 82 | return true; |
83 | 83 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | public function get($key) |
91 | 91 | { |
92 | - return $this->objects[$key] ?? null; |
|
92 | + return $this->objects[ $key ] ?? null; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | public function getKeys() |
@@ -109,12 +109,12 @@ discard block |
||
109 | 109 | |
110 | 110 | public function set($key, $value): void |
111 | 111 | { |
112 | - $this->objects[$key] = $value; |
|
112 | + $this->objects[ $key ] = $value; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | public function add($element): void |
116 | 116 | { |
117 | - $this->objects[] = $element; |
|
117 | + $this->objects[ ] = $element; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | public function isEmpty(): bool |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | public function clear(): void |
126 | 126 | { |
127 | - $this->objects = []; |
|
127 | + $this->objects = [ ]; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | public function applyReverse() |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | { |
41 | 41 | $this->expectException(InvalidCollectionObjectException::class); |
42 | 42 | |
43 | - new Collection([new stdClass(), new stdClass()]); |
|
43 | + new Collection([ new stdClass(), new stdClass() ]); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function itShouldReturnEmptyCollection(): void |
58 | 58 | { |
59 | - $collection = new Collection([]); |
|
59 | + $collection = new Collection([ ]); |
|
60 | 60 | |
61 | 61 | $this->assertEmpty($collection->getCollection()); |
62 | 62 | } |
@@ -12,10 +12,10 @@ |
||
12 | 12 | public function currencyCodeProvider(): array |
13 | 13 | { |
14 | 14 | return [ |
15 | - ['EUR'], |
|
16 | - ['USD'], |
|
17 | - ['KYD'], |
|
18 | - ['HKD'], |
|
15 | + [ 'EUR' ], |
|
16 | + [ 'USD' ], |
|
17 | + [ 'KYD' ], |
|
18 | + [ 'HKD' ], |
|
19 | 19 | ]; |
20 | 20 | } |
21 | 21 | /** |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | public function localeProvider(): array |
13 | 13 | { |
14 | 14 | return [ |
15 | - ['es_ES'], |
|
16 | - ['es_AR'], |
|
17 | - ['en_GB'], |
|
18 | - ['en_US'], |
|
15 | + [ 'es_ES' ], |
|
16 | + [ 'es_AR' ], |
|
17 | + [ 'en_GB' ], |
|
18 | + [ 'en_US' ], |
|
19 | 19 | |
20 | 20 | ]; |
21 | 21 | } |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | public function invalidLocaleProvider(): array |
35 | 35 | { |
36 | 36 | return [ |
37 | - [$this->faker()->address], |
|
38 | - [$this->faker()->numberBetween()], |
|
37 | + [ $this->faker()->address ], |
|
38 | + [ $this->faker()->numberBetween() ], |
|
39 | 39 | ]; |
40 | 40 | } |
41 | 41 |
@@ -23,8 +23,8 @@ |
||
23 | 23 | public function invalidLongitudeProvider(): array |
24 | 24 | { |
25 | 25 | return [ |
26 | - [$this->faker()->randomFloat(4, -200, -185)], |
|
27 | - [$this->faker()->randomFloat(4, 185, 200)] |
|
26 | + [ $this->faker()->randomFloat(4, -200, -185) ], |
|
27 | + [ $this->faker()->randomFloat(4, 185, 200) ] |
|
28 | 28 | ]; |
29 | 29 | } |
30 | 30 |
@@ -14,10 +14,10 @@ discard block |
||
14 | 14 | public function countryCodeProvider(): array |
15 | 15 | { |
16 | 16 | return [ |
17 | - ['GB'], |
|
18 | - ['ES'], |
|
19 | - ['BA'], |
|
20 | - ['FR'], |
|
17 | + [ 'GB' ], |
|
18 | + [ 'ES' ], |
|
19 | + [ 'BA' ], |
|
20 | + [ 'FR' ], |
|
21 | 21 | ]; |
22 | 22 | } |
23 | 23 | |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | public function invalidCountryCodeProvider(): array |
37 | 37 | { |
38 | 38 | return [ |
39 | - [$this->faker()->address], |
|
40 | - [$this->faker()->numberBetween()] |
|
39 | + [ $this->faker()->address ], |
|
40 | + [ $this->faker()->numberBetween() ] |
|
41 | 41 | ]; |
42 | 42 | } |
43 | 43 |
@@ -23,8 +23,8 @@ |
||
23 | 23 | public function invalidLatitudeProvider(): array |
24 | 24 | { |
25 | 25 | return [ |
26 | - [$this->faker()->randomFloat(4, -200, -95)], |
|
27 | - [$this->faker()->randomFloat(4, 100, 200)] |
|
26 | + [ $this->faker()->randomFloat(4, -200, -95) ], |
|
27 | + [ $this->faker()->randomFloat(4, 100, 200) ] |
|
28 | 28 | ]; |
29 | 29 | } |
30 | 30 |
@@ -25,8 +25,8 @@ |
||
25 | 25 | public function invalidLanguageCodeProvider(): array |
26 | 26 | { |
27 | 27 | return [ |
28 | - [$this->faker()->address], |
|
29 | - [$this->faker()->numberBetween()], |
|
28 | + [ $this->faker()->address ], |
|
29 | + [ $this->faker()->numberBetween() ], |
|
30 | 30 | ]; |
31 | 31 | } |
32 | 32 |
@@ -7,6 +7,6 @@ |
||
7 | 7 | { |
8 | 8 | protected function throwException($value): void |
9 | 9 | { |
10 | - throw new \Exception((string)$value); |
|
10 | + throw new \Exception((string) $value); |
|
11 | 11 | } |
12 | 12 | } |