@@ -85,8 +85,7 @@ discard block |
||
| 85 | 85 | * @param mixed $valueType |
| 86 | 86 | * @param array<mixed, mixed> $initials |
| 87 | 87 | */ |
| 88 | - public function __construct($keyType, $valueType, array $initials = []) |
|
| 89 | - { |
|
| 88 | + public function __construct($keyType, $valueType, array $initials = []) { |
|
| 90 | 89 | $this->keyType = $keyType; |
| 91 | 90 | $this->valueType = $valueType; |
| 92 | 91 | |
@@ -155,8 +154,7 @@ discard block |
||
| 155 | 154 | * Return the type of the key |
| 156 | 155 | * @return mixed |
| 157 | 156 | */ |
| 158 | - public function getKeyType() |
|
| 159 | - { |
|
| 157 | + public function getKeyType() { |
|
| 160 | 158 | return $this->keyType; |
| 161 | 159 | } |
| 162 | 160 | |
@@ -164,8 +162,7 @@ discard block |
||
| 164 | 162 | * Return the type of the value |
| 165 | 163 | * @return mixed |
| 166 | 164 | */ |
| 167 | - public function getValueType() |
|
| 168 | - { |
|
| 165 | + public function getValueType() { |
|
| 169 | 166 | return $this->valueType; |
| 170 | 167 | } |
| 171 | 168 | |
@@ -246,8 +243,7 @@ discard block |
||
| 246 | 243 | /** |
| 247 | 244 | * {@inheritedoc} |
| 248 | 245 | */ |
| 249 | - public function get($key) |
|
| 250 | - { |
|
| 246 | + public function get($key) { |
|
| 251 | 247 | return $this->data->offsetExists($key) |
| 252 | 248 | ? $this->data->offsetGet($key)->getValue() |
| 253 | 249 | : null; |
@@ -50,8 +50,7 @@ discard block |
||
| 50 | 50 | * Class Pair |
| 51 | 51 | * @package Platine\Collection\Map |
| 52 | 52 | */ |
| 53 | -class Pair |
|
| 54 | -{ |
|
| 53 | +class Pair { |
|
| 55 | 54 | |
| 56 | 55 | /** |
| 57 | 56 | * |
@@ -70,8 +69,7 @@ discard block |
||
| 70 | 69 | * @param mixed $key |
| 71 | 70 | * @param mixed $value |
| 72 | 71 | */ |
| 73 | - public function __construct($key, $value) |
|
| 74 | - { |
|
| 72 | + public function __construct($key, $value) { |
|
| 75 | 73 | $this->key = $key; |
| 76 | 74 | $this->value = $value; |
| 77 | 75 | } |
@@ -80,8 +78,7 @@ discard block |
||
| 80 | 78 | * |
| 81 | 79 | * @return mixed |
| 82 | 80 | */ |
| 83 | - public function getKey() |
|
| 84 | - { |
|
| 81 | + public function getKey() { |
|
| 85 | 82 | return $this->key; |
| 86 | 83 | } |
| 87 | 84 | |
@@ -89,8 +86,7 @@ discard block |
||
| 89 | 86 | * |
| 90 | 87 | * @return mixed |
| 91 | 88 | */ |
| 92 | - public function getValue() |
|
| 93 | - { |
|
| 89 | + public function getValue() { |
|
| 94 | 90 | return $this->value; |
| 95 | 91 | } |
| 96 | 92 | |
@@ -54,8 +54,7 @@ discard block |
||
| 54 | 54 | * Class Stack |
| 55 | 55 | * @package Platine\Collection\Stack |
| 56 | 56 | */ |
| 57 | -class Stack implements Countable |
|
| 58 | -{ |
|
| 57 | +class Stack implements Countable { |
|
| 59 | 58 | |
| 60 | 59 | /** |
| 61 | 60 | * |
@@ -73,8 +72,7 @@ discard block |
||
| 73 | 72 | * Create new instance |
| 74 | 73 | * @param string $type |
| 75 | 74 | */ |
| 76 | - public function __construct(string $type) |
|
| 77 | - { |
|
| 75 | + public function __construct(string $type) { |
|
| 78 | 76 | $this->data = []; |
| 79 | 77 | $this->type = $type; |
| 80 | 78 | } |
@@ -108,8 +106,7 @@ discard block |
||
| 108 | 106 | /** |
| 109 | 107 | * @return mixed |
| 110 | 108 | */ |
| 111 | - public function peek() |
|
| 112 | - { |
|
| 109 | + public function peek() { |
|
| 113 | 110 | if ($this->isEmpty()) { |
| 114 | 111 | throw new InvalidOperationException('The collection is empty'); |
| 115 | 112 | } |
@@ -121,8 +118,7 @@ discard block |
||
| 121 | 118 | * |
| 122 | 119 | * @return mixed |
| 123 | 120 | */ |
| 124 | - public function pop() |
|
| 125 | - { |
|
| 121 | + public function pop() { |
|
| 126 | 122 | return array_pop($this->data); |
| 127 | 123 | } |
| 128 | 124 | |
@@ -132,8 +128,7 @@ discard block |
||
| 132 | 128 | * @param mixed $value |
| 133 | 129 | * @return mixed |
| 134 | 130 | */ |
| 135 | - public function push($value) |
|
| 136 | - { |
|
| 131 | + public function push($value) { |
|
| 137 | 132 | TypeCheck::isValueOf( |
| 138 | 133 | $value, |
| 139 | 134 | $this->type, |
@@ -73,8 +73,7 @@ discard block |
||
| 73 | 73 | * Create new instance |
| 74 | 74 | * @param array<mixed, mixed> $data |
| 75 | 75 | */ |
| 76 | - public function __construct(array $data = []) |
|
| 77 | - { |
|
| 76 | + public function __construct(array $data = []) { |
|
| 78 | 77 | foreach ($data as $value) { |
| 79 | 78 | $this->validateEntry($value); |
| 80 | 79 | } |
@@ -180,8 +179,7 @@ discard block |
||
| 180 | 179 | * @return mixed |
| 181 | 180 | * @throws OutOfRangeException |
| 182 | 181 | */ |
| 183 | - public function get(int $offset) |
|
| 184 | - { |
|
| 182 | + public function get(int $offset) { |
|
| 185 | 183 | if ($this->isEmpty()) { |
| 186 | 184 | throw new OutOfRangeException('The collection is empty'); |
| 187 | 185 | } |
@@ -268,8 +266,7 @@ discard block |
||
| 268 | 266 | * Return a random element of the collection |
| 269 | 267 | * @return mixed |
| 270 | 268 | */ |
| 271 | - public function rand() |
|
| 272 | - { |
|
| 269 | + public function rand() { |
|
| 273 | 270 | if ($this->isEmpty()) { |
| 274 | 271 | throw new InvalidOperationException('The collection is empty'); |
| 275 | 272 | } |
@@ -52,15 +52,13 @@ |
||
| 52 | 52 | * @template Object |
| 53 | 53 | * @extends TypedCollection<Object> |
| 54 | 54 | */ |
| 55 | -class ObjectCollection extends TypedCollection |
|
| 56 | -{ |
|
| 55 | +class ObjectCollection extends TypedCollection { |
|
| 57 | 56 | |
| 58 | 57 | /** |
| 59 | 58 | * Create new instance |
| 60 | 59 | * @param array<mixed, mixed> $data |
| 61 | 60 | */ |
| 62 | - public function __construct(array $data = []) |
|
| 63 | - { |
|
| 61 | + public function __construct(array $data = []) { |
|
| 64 | 62 | parent::__construct('object', $data); |
| 65 | 63 | } |
| 66 | 64 | } |
@@ -55,16 +55,14 @@ |
||
| 55 | 55 | * @template T |
| 56 | 56 | * @extends Collection<T> |
| 57 | 57 | */ |
| 58 | -class TypedCollection extends Collection |
|
| 59 | -{ |
|
| 58 | +class TypedCollection extends Collection { |
|
| 60 | 59 | |
| 61 | 60 | /** |
| 62 | 61 | * Create new instance |
| 63 | 62 | * @param string $type |
| 64 | 63 | * @param array<mixed, mixed> $data |
| 65 | 64 | */ |
| 66 | - public function __construct(string $type, array $data = []) |
|
| 67 | - { |
|
| 65 | + public function __construct(string $type, array $data = []) { |
|
| 68 | 66 | $this->type = $type; |
| 69 | 67 | parent::__construct($data); |
| 70 | 68 | } |