@@ -21,7 +21,7 @@ |
||
21 | 21 | throw new InvalidPolygonException(); |
22 | 22 | } |
23 | 23 | |
24 | - $first = $value[0]; |
|
24 | + $first = $value[ 0 ]; |
|
25 | 25 | $end = end($value); |
26 | 26 | |
27 | 27 | foreach ($value as $point) { |
@@ -13,33 +13,33 @@ discard block |
||
13 | 13 | $latitude = $this->faker()->latitude; |
14 | 14 | $longitude = $this->faker()->longitude; |
15 | 15 | return [ |
16 | - ['no_array' => 'string'], |
|
16 | + [ 'no_array' => 'string' ], |
|
17 | 17 | [ |
18 | 18 | 'no_two_elements_by_array' => [ |
19 | - [$this->faker()->latitude], |
|
20 | - [$this->faker()->lastName, $this->faker()->longitude], |
|
21 | - [$this->faker()->lastName, $this->faker()->longitude] |
|
19 | + [ $this->faker()->latitude ], |
|
20 | + [ $this->faker()->lastName, $this->faker()->longitude ], |
|
21 | + [ $this->faker()->lastName, $this->faker()->longitude ] |
|
22 | 22 | ] |
23 | 23 | ], |
24 | 24 | [ |
25 | 25 | 'no_same_start_end_data' => [ |
26 | - [$this->faker()->latitude, $this->faker()->longitude], |
|
27 | - [$this->faker()->latitude, $this->faker()->longitude], |
|
28 | - [$this->faker()->latitude, $this->faker()->randomFloat()], |
|
26 | + [ $this->faker()->latitude, $this->faker()->longitude ], |
|
27 | + [ $this->faker()->latitude, $this->faker()->longitude ], |
|
28 | + [ $this->faker()->latitude, $this->faker()->randomFloat() ], |
|
29 | 29 | ] |
30 | 30 | ], |
31 | 31 | [ |
32 | 32 | 'no_polygon' => [ |
33 | - [$latitude, $longitude], |
|
34 | - [$latitude, $longitude], |
|
33 | + [ $latitude, $longitude ], |
|
34 | + [ $latitude, $longitude ], |
|
35 | 35 | ] |
36 | 36 | ], |
37 | 37 | [ |
38 | 38 | 'element_no_array' => [ |
39 | - [$latitude, $longitude], |
|
39 | + [ $latitude, $longitude ], |
|
40 | 40 | 'string', |
41 | - [$this->faker()->lastName, $this->faker()->longitude], |
|
42 | - [$latitude, $longitude] |
|
41 | + [ $this->faker()->lastName, $this->faker()->longitude ], |
|
42 | + [ $latitude, $longitude ] |
|
43 | 43 | ] |
44 | 44 | ] |
45 | 45 | ]; |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | $longitude = $this->faker()->longitude; |
67 | 67 | |
68 | 68 | $data = [ |
69 | - [$latitude, $longitude], |
|
70 | - [$this->faker()->latitude, $this->faker()->longitude], |
|
71 | - [$latitude, $longitude] |
|
69 | + [ $latitude, $longitude ], |
|
70 | + [ $this->faker()->latitude, $this->faker()->longitude ], |
|
71 | + [ $latitude, $longitude ] |
|
72 | 72 | ]; |
73 | 73 | |
74 | 74 | $polygon = new PolygonValueObject($data); |
@@ -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 | } |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | throw new InvalidMultiPolygonException(); |
23 | 23 | } |
24 | 24 | |
25 | - $values = []; |
|
25 | + $values = [ ]; |
|
26 | 26 | |
27 | 27 | foreach ($value as $item) { |
28 | - $values[] = new PolygonValueObject($item); |
|
28 | + $values[ ] = new PolygonValueObject($item); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | $this->value = $this->getScalarValues($values); |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | */ |
38 | 38 | private function getScalarValues(array $values): array |
39 | 39 | { |
40 | - $scalar = []; |
|
40 | + $scalar = [ ]; |
|
41 | 41 | |
42 | 42 | foreach ($values as $value) { |
43 | - $scalar[] = $value->value(); |
|
43 | + $scalar[ ] = $value->value(); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | return $scalar; |
@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | protected function guard($value): void |
13 | 13 | { |
14 | - if (false === (bool)preg_match('/^[a-f0-9]{40}$/', $value)) { |
|
14 | + if (false === (bool) preg_match('/^[a-f0-9]{40}$/', $value)) { |
|
15 | 15 | throw new InvalidSha1Exception($value); |
16 | 16 | } |
17 | 17 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | protected function guard($value): void |
13 | 13 | { |
14 | - if (false === (bool)preg_match('/^[a-f0-9]{64}$/', $value)) { |
|
14 | + if (false === (bool) preg_match('/^[a-f0-9]{64}$/', $value)) { |
|
15 | 15 | throw new InvalidSha256Exception($value); |
16 | 16 | } |
17 | 17 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | { |
12 | 12 | protected function guard($value): void |
13 | 13 | { |
14 | - if (false === (bool)preg_match('/^[a-f0-9]{32}$/', $value)) { |
|
14 | + if (false === (bool) preg_match('/^[a-f0-9]{32}$/', $value)) { |
|
15 | 15 | throw new InvalidMd5Exception($value); |
16 | 16 | } |
17 | 17 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | public function invalidDataProvider(): array |
13 | 13 | { |
14 | 14 | return [ |
15 | - 'no_array' => ['string'] |
|
15 | + 'no_array' => [ 'string' ] |
|
16 | 16 | ]; |
17 | 17 | } |
18 | 18 | |
@@ -39,16 +39,16 @@ discard block |
||
39 | 39 | |
40 | 40 | $data = [ |
41 | 41 | [ |
42 | - [$latitude1, $longitude1], |
|
43 | - [$this->faker()->latitude, $this->faker()->longitude], |
|
44 | - [$this->faker()->latitude, $this->faker()->longitude], |
|
45 | - [$latitude1, $longitude1], |
|
42 | + [ $latitude1, $longitude1 ], |
|
43 | + [ $this->faker()->latitude, $this->faker()->longitude ], |
|
44 | + [ $this->faker()->latitude, $this->faker()->longitude ], |
|
45 | + [ $latitude1, $longitude1 ], |
|
46 | 46 | ], |
47 | 47 | [ |
48 | - [$latitude2, $longitude2], |
|
49 | - [$this->faker()->latitude, $this->faker()->longitude], |
|
50 | - [$this->faker()->latitude, $this->faker()->longitude], |
|
51 | - [$latitude2, $longitude2] |
|
48 | + [ $latitude2, $longitude2 ], |
|
49 | + [ $this->faker()->latitude, $this->faker()->longitude ], |
|
50 | + [ $this->faker()->latitude, $this->faker()->longitude ], |
|
51 | + [ $latitude2, $longitude2 ] |
|
52 | 52 | ] |
53 | 53 | ]; |
54 | 54 |
@@ -26,8 +26,8 @@ |
||
26 | 26 | public function invalidIpv4AddressProvider(): array |
27 | 27 | { |
28 | 28 | return [ |
29 | - [$this->faker()->numberBetween()], |
|
30 | - [$this->faker()->ipv6] |
|
29 | + [ $this->faker()->numberBetween() ], |
|
30 | + [ $this->faker()->ipv6 ] |
|
31 | 31 | ]; |
32 | 32 | } |
33 | 33 |