@@ -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; |
@@ -54,12 +54,12 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | public function remove($key) |
| 56 | 56 | { |
| 57 | - if (!isset($this->objects[$key]) && !array_key_exists($key, $this->objects)) { |
|
| 57 | + if (!isset($this->objects[ $key ]) && !array_key_exists($key, $this->objects)) { |
|
| 58 | 58 | return null; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - $removed = $this->objects[$key]; |
|
| 62 | - unset($this->objects[$key]); |
|
| 61 | + $removed = $this->objects[ $key ]; |
|
| 62 | + unset($this->objects[ $key ]); |
|
| 63 | 63 | |
| 64 | 64 | return $removed; |
| 65 | 65 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | return false; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - unset($this->objects[$key]); |
|
| 75 | + unset($this->objects[ $key ]); |
|
| 76 | 76 | |
| 77 | 77 | return true; |
| 78 | 78 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | public function get($key) |
| 86 | 86 | { |
| 87 | - return $this->objects[$key] ?? null; |
|
| 87 | + return $this->objects[ $key ] ?? null; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | public function getKeys() |
@@ -104,12 +104,12 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | public function set($key, $value): void |
| 106 | 106 | { |
| 107 | - $this->objects[$key] = $value; |
|
| 107 | + $this->objects[ $key ] = $value; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | public function add($element): void |
| 111 | 111 | { |
| 112 | - $this->objects[] = $element; |
|
| 112 | + $this->objects[ ] = $element; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | public function isEmpty(): bool |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | public function clear(): void |
| 121 | 121 | { |
| 122 | - $this->objects = []; |
|
| 122 | + $this->objects = [ ]; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | } |
@@ -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 | |
@@ -25,8 +25,8 @@ |
||
| 25 | 25 | public function invalidUrlProvider(): array |
| 26 | 26 | { |
| 27 | 27 | return [ |
| 28 | - [$this->faker()->email], |
|
| 29 | - [$this->faker()->phoneNumber], |
|
| 28 | + [ $this->faker()->email ], |
|
| 29 | + [ $this->faker()->phoneNumber ], |
|
| 30 | 30 | ]; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -24,10 +24,10 @@ |
||
| 24 | 24 | public function invalidTcpPortProvider(): array |
| 25 | 25 | { |
| 26 | 26 | return [ |
| 27 | - [11362.0], |
|
| 28 | - [$this->faker()->randomFloat()], |
|
| 29 | - [$this->faker()->numberBetween(65536)], |
|
| 30 | - [-$this->faker()->numberBetween()], |
|
| 27 | + [ 11362.0 ], |
|
| 28 | + [ $this->faker()->randomFloat() ], |
|
| 29 | + [ $this->faker()->numberBetween(65536) ], |
|
| 30 | + [-$this->faker()->numberBetween() ], |
|
| 31 | 31 | ]; |
| 32 | 32 | } |
| 33 | 33 | |