@@ -22,7 +22,7 @@ |
||
| 22 | 22 | |
| 23 | 23 | public function getIterator() |
| 24 | 24 | { |
| 25 | - return new ArrayIterator(array_map(static function (MapEntry $entry) { |
|
| 25 | + return new ArrayIterator(array_map(static function(MapEntry $entry) { |
|
| 26 | 26 | return $entry->getValue(); |
| 27 | 27 | }, $this->entries)); |
| 28 | 28 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | public static function toPropertyValue(string $name): Closure |
| 19 | 19 | { |
| 20 | - return static function ($obj) use ($name) { |
|
| 20 | + return static function($obj) use ($name) { |
|
| 21 | 21 | return ObjectFunctions::getPropertyValue($obj, $name); |
| 22 | 22 | }; |
| 23 | 23 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public static function toProperties(array $names): Closure |
| 31 | 31 | { |
| 32 | - return static function ($obj) use ($names) { |
|
| 32 | + return static function($obj) use ($names) { |
|
| 33 | 33 | $res = []; |
| 34 | 34 | foreach ($names as $name) { |
| 35 | 35 | $res[$name] = ObjectFunctions::getPropertyValue($obj, $name); |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | |
| 60 | 60 | public function removeAt(int $index) |
| 61 | 61 | { |
| 62 | - throw $this->createBlockingException(); |
|
| 62 | + throw $this->createBlockingException(); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | private function createBlockingException(): RuntimeException |
@@ -12,11 +12,11 @@ |
||
| 12 | 12 | if ($this->isEmpty()) { |
| 13 | 13 | return false; |
| 14 | 14 | } |
| 15 | - $fMatch = static function ($tested) use ($element): bool { |
|
| 15 | + $fMatch = static function($tested) use ($element): bool { |
|
| 16 | 16 | return $tested === $element; |
| 17 | 17 | }; |
| 18 | 18 | if ($element instanceof HashCodeAware) { |
| 19 | - $fMatch = static function ($tested) use ($element): bool { |
|
| 19 | + $fMatch = static function($tested) use ($element): bool { |
|
| 20 | 20 | if ($tested instanceof HashCodeAware) { |
| 21 | 21 | return $tested->getHashCode() === $element->getHashCode(); |
| 22 | 22 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | public function reorganize(callable $reorganizer): Stream |
| 54 | 54 | { |
| 55 | 55 | $reorganizedCollection = $reorganizer($this->list); |
| 56 | - if (! $reorganizedCollection instanceof Collection) { |
|
| 56 | + if (!$reorganizedCollection instanceof Collection) { |
|
| 57 | 57 | throw new RuntimeException('Result set of reorganizer call must be instance of Collection interface'); |
| 58 | 58 | } |
| 59 | 59 | $this->list = $reorganizedCollection; |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | { |
| 124 | 124 | $values = []; |
| 125 | 125 | $map = []; |
| 126 | - $this->each(static function ($el) use ($extractor, & $map, & $values) { |
|
| 126 | + $this->each(static function($el) use ($extractor, & $map, & $values) { |
|
| 127 | 127 | $value = $extractor($el); |
| 128 | 128 | if (!is_scalar($value)) { |
| 129 | 129 | throw new RuntimeException('Only scalar value can be as result of sort extractor'); |
@@ -166,12 +166,12 @@ discard block |
||
| 166 | 166 | $size = $this->list->size(); |
| 167 | 167 | /** @var ListSequence $list */ |
| 168 | 168 | $list = $this->list->copy(); |
| 169 | - $this->walk(static function ($head, $index) use ($list, $size) { |
|
| 169 | + $this->walk(static function($head, $index) use ($list, $size) { |
|
| 170 | 170 | $tailIndex = $size - $index - 1; |
| 171 | 171 | $tail = $list->get($tailIndex); |
| 172 | 172 | $list->set($tail, $index); |
| 173 | 173 | $list->set($head, $tailIndex); |
| 174 | - }, (int)($size/2)); |
|
| 174 | + }, (int)($size / 2)); |
|
| 175 | 175 | $this->list = $list; |
| 176 | 176 | |
| 177 | 177 | return $this; |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | public function limit(int $count): Stream |
| 304 | 304 | { |
| 305 | 305 | $newCollection = $this->emptyList(); |
| 306 | - $this->walk(static function ($el) use ($newCollection) { |
|
| 306 | + $this->walk(static function($el) use ($newCollection) { |
|
| 307 | 307 | $newCollection->add($el); |
| 308 | 308 | }, $count); |
| 309 | 309 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | public static function directSequence($length): Iterator |
| 11 | 11 | { |
| 12 | 12 | $current = 0; |
| 13 | - return new CallbackIterator(static function () use (& $current, $length) { |
|
| 13 | + return new CallbackIterator(static function() use (& $current, $length) { |
|
| 14 | 14 | if ($current === $length) { |
| 15 | 15 | return (new IterateResult())->setAsRunOut(); |
| 16 | 16 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | public static function reverseSequence($length): Iterator |
| 23 | 23 | { |
| 24 | 24 | $current = $length - 1; |
| 25 | - return new CallbackIterator(static function () use (& $current) { |
|
| 25 | + return new CallbackIterator(static function() use (& $current) { |
|
| 26 | 26 | if ($current === -1) { |
| 27 | 27 | return (new IterateResult())->setAsRunOut(); |
| 28 | 28 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | if ($times < 0) { |
| 23 | 23 | throw new RuntimeException('The count of values ($times) must be a positive value'); |
| 24 | 24 | } |
| 25 | - $generator = $generator ?? static function (int $index) { |
|
| 25 | + $generator = $generator ?? static function(int $index) { |
|
| 26 | 26 | return $index; |
| 27 | 27 | }; |
| 28 | 28 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public static function concat(string $delimiter = ''): Closure |
| 26 | 26 | { |
| 27 | - return static function (Collection $collection) use ($delimiter) { |
|
| 27 | + return static function(Collection $collection) use ($delimiter) { |
|
| 28 | 28 | return implode($delimiter, $collection->toArray()); |
| 29 | 29 | }; |
| 30 | 30 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | * @param Collection $collection |
| 40 | 40 | * @return float|int |
| 41 | 41 | */ |
| 42 | - return static function (Collection $collection) { |
|
| 42 | + return static function(Collection $collection) { |
|
| 43 | 43 | $array = $collection->toArray(); |
| 44 | 44 | |
| 45 | 45 | return array_sum($array) / count($array); |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public static function group(): Closure |
| 54 | 54 | { |
| 55 | - return static function (Collection $collection): Map { |
|
| 56 | - $groupBy = self::groupBy(static function ($el) { |
|
| 55 | + return static function(Collection $collection): Map { |
|
| 56 | + $groupBy = self::groupBy(static function($el) { |
|
| 57 | 57 | return $el; |
| 58 | 58 | }); |
| 59 | 59 | return $groupBy($collection); |
@@ -67,8 +67,8 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public static function groupByProperty(string $property): Closure |
| 69 | 69 | { |
| 70 | - return static function (Collection $collection) use ($property): Map { |
|
| 71 | - $fGetValue = static function ($obj) use ($property) { |
|
| 70 | + return static function(Collection $collection) use ($property): Map { |
|
| 71 | + $fGetValue = static function($obj) use ($property) { |
|
| 72 | 72 | return ObjectFunctions::getPropertyValue($obj, $property); |
| 73 | 73 | }; |
| 74 | 74 | |
@@ -84,11 +84,11 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public static function groupBy(callable $f): Closure |
| 86 | 86 | { |
| 87 | - return static function (Collection $collection) use ($f): Map { |
|
| 87 | + return static function(Collection $collection) use ($f): Map { |
|
| 88 | 88 | $group = new HashMap(); |
| 89 | 89 | $collection |
| 90 | 90 | ->stream() |
| 91 | - ->each(static function ($el) use ($group, $f) { |
|
| 91 | + ->each(static function($el) use ($group, $f) { |
|
| 92 | 92 | $value = $f($el); |
| 93 | 93 | $count = 0; |
| 94 | 94 | if (($gCount = $group->get($value)) !== null) { |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public static function dump(): callable |
| 15 | 15 | { |
| 16 | - return static function ($el) { |
|
| 16 | + return static function($el) { |
|
| 17 | 17 | var_dump($el); |
| 18 | 18 | }; |
| 19 | 19 | } |