@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | function mixed_to_closure($closure) |
70 | 70 | { |
71 | 71 | if (is_null($closure)) { |
72 | - return function ($value) { |
|
72 | + return function($value) { |
|
73 | 73 | return $value; |
74 | 74 | }; |
75 | 75 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | // A \Closure is always callable, but a callable is not always a \Closure. |
80 | 80 | // Checking within this if statement is a slight optimization, preventing an unnecessary function wrap |
81 | 81 | if (is_callable($closure)) { |
82 | - $closure = function () use ($closure) { |
|
82 | + $closure = function() use ($closure) { |
|
83 | 83 | return call_user_func_array($closure, func_get_args()); |
84 | 84 | }; |
85 | 85 | } else { |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | { |
112 | 112 | if (is_string($strategy)) { |
113 | 113 | $keyParts = explode('.', $strategy); |
114 | - $strategy = function ($value) use ($keyParts) { |
|
114 | + $strategy = function($value) use ($keyParts) { |
|
115 | 115 | foreach ($keyParts as $keyPart) { |
116 | 116 | if (is_object($value)) { |
117 | 117 | // property_exists does not distinguish between public, protected, or private properties, hence we need to use reflection |
@@ -48,7 +48,7 @@ |
||
48 | 48 | |
49 | 49 | public function __construct(/* \Iterator $iterable1, \Iterator $iterable2, ... */) |
50 | 50 | { |
51 | - parent::__construct(\MultipleIterator::MIT_NEED_ALL| \MultipleIterator::MIT_KEYS_NUMERIC); |
|
51 | + parent::__construct(\MultipleIterator::MIT_NEED_ALL|\MultipleIterator::MIT_KEYS_NUMERIC); |
|
52 | 52 | foreach (func_get_args() as $iterable) { |
53 | 53 | if (!$iterable instanceof \Iterator) { |
54 | 54 | throw new \InvalidArgumentException(sprintf('Not all arguments are iterators')); |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | |
62 | 62 | public function __construct(\Closure $valueFunc /* [\Closure $keyFunc], \Iterator $iterable1, [\Iterator $iterable2, [...]] */) |
63 | 63 | { |
64 | - parent::__construct(\MultipleIterator::MIT_NEED_ALL| \MultipleIterator::MIT_KEYS_NUMERIC); |
|
64 | + parent::__construct(\MultipleIterator::MIT_NEED_ALL|\MultipleIterator::MIT_KEYS_NUMERIC); |
|
65 | 65 | $args = func_get_args(); |
66 | 66 | $argsContainsKeyFunc = $args[1] instanceof \Closure; |
67 | 67 | $this->valueFunc = $args[0]; |
68 | - $this->keyFunc = $argsContainsKeyFunc ? $args[1] : function () { return $this->genericKeysToKey(func_get_args()); }; |
|
68 | + $this->keyFunc = $argsContainsKeyFunc ? $args[1] : function() { return $this->genericKeysToKey(func_get_args()); }; |
|
69 | 69 | foreach (array_slice($args, $argsContainsKeyFunc ? 2 : 1) as $iterable) { |
70 | 70 | if (!$iterable instanceof \Iterator) { |
71 | 71 | throw new \InvalidArgumentException(sprintf('Not all arguments are iterators')); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | foreach ($keys as $key) { |
87 | 87 | if ($key !== $value) { |
88 | 88 | // the keys are different, we will make a new string identifying this entry |
89 | - return join(':', array_map(function ($key) { return (string)$key; }, $keys)); |
|
89 | + return join(':', array_map(function($key) { return (string)$key; }, $keys)); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | // http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list |
175 | 175 | |
176 | 176 | $iterables = array_map( |
177 | - function ($iterable) { |
|
177 | + function($iterable) { |
|
178 | 178 | return conversions\mixed_to_iterator($iterable); |
179 | 179 | }, |
180 | 180 | func_get_args() |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | // http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list |
328 | 328 | |
329 | 329 | $iterables = array_map( |
330 | - function ($iterable) { |
|
330 | + function($iterable) { |
|
331 | 331 | return conversions\mixed_to_iterator($iterable); |
332 | 332 | }, |
333 | 333 | array_slice(func_get_args(), 1) |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | } |
526 | 526 | |
527 | 527 | $strategy = conversions\mixed_to_value_getter($strategy); |
528 | - $isValid = function ($value, $key) use ($strategy) { |
|
528 | + $isValid = function($value, $key) use ($strategy) { |
|
529 | 529 | $tempVarPhp54 = $strategy($value, $key); |
530 | 530 | return !empty($tempVarPhp54); |
531 | 531 | }; |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | switch (sizeof($args)) { |
563 | 563 | case 2: |
564 | 564 | $strategy = conversions\mixed_to_value_getter($args[0]); |
565 | - $closure = function ($value, $key) use ($strategy) { |
|
565 | + $closure = function($value, $key) use ($strategy) { |
|
566 | 566 | $tempVarPhp54 = call_user_func($strategy, $value, $key); |
567 | 567 | return !empty($tempVarPhp54); |
568 | 568 | }; |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | case 3: |
573 | 573 | $strategy = conversions\mixed_to_value_getter($args[0]); |
574 | 574 | $userClosure = $args[1]; |
575 | - $closure = function ($value, $key) use ($strategy, $userClosure) { |
|
575 | + $closure = function($value, $key) use ($strategy, $userClosure) { |
|
576 | 576 | return call_user_func($userClosure, call_user_func($strategy, $value, $key)); |
577 | 577 | }; |
578 | 578 | $iterable = conversions\mixed_to_iterator($args[2]); |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | // http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list |
608 | 608 | |
609 | 609 | $iterables = array_map( |
610 | - function ($iterable) { |
|
610 | + function($iterable) { |
|
611 | 611 | return conversions\mixed_to_iterator($iterable); |
612 | 612 | }, |
613 | 613 | func_get_args() |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | * > count(2.5, 0.5) |
194 | 194 | * 2.5 3.0 3.5 4.0 ... |
195 | 195 | * |
196 | - * @param int|float $start |
|
197 | - * @param int|float $step |
|
196 | + * @param integer $start |
|
197 | + * @param integer $step |
|
198 | 198 | * @return CountIterator |
199 | 199 | */ |
200 | 200 | function count($start = 0, $step = 1) |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * > cycle('ABCD') |
219 | 219 | * A B C D A B C D A B C D ... |
220 | 220 | * |
221 | - * @param array|string|\Iterator $iterable |
|
221 | + * @param lib\Traits\CycleTrait $iterable |
|
222 | 222 | * @return CycleIterator |
223 | 223 | */ |
224 | 224 | function cycle($iterable) |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | * the same key function |
442 | 442 | * |
443 | 443 | * @param null|string|\Closure $strategy |
444 | - * @param array|string|\Iterator $iterable |
|
444 | + * @param lib\Traits\GroupByTrait $iterable |
|
445 | 445 | * @param boolean $sort |
446 | 446 | * @return GroupbyIterator |
447 | 447 | * |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | /** |
620 | 620 | * Returns an iterable with all the elements from $iterable reversed |
621 | 621 | * |
622 | - * @param array|string|\Iterator $iterable |
|
622 | + * @param lib\Traits\ReversedTrait $iterable |
|
623 | 623 | * @return ReversedIterator |
624 | 624 | */ |
625 | 625 | function reversed($iterable) |
@@ -802,7 +802,7 @@ discard block |
||
802 | 802 | * > slice(['a', 'b', 'c', 'd', 'e', 1, -1] |
803 | 803 | * 'b', 'c', 'd' |
804 | 804 | * |
805 | - * @param array|string|\Iterator $iterable |
|
805 | + * @param lib\Traits\SliceTrait $iterable |
|
806 | 806 | * @param integer $start |
807 | 807 | * @param null|integer $end |
808 | 808 | * @return SliceIterator |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | * > first([]) |
828 | 828 | * null |
829 | 829 | * |
830 | - * @param array|string|\Iterator $iterable |
|
830 | + * @param lib\Traits\FirstTrait $iterable |
|
831 | 831 | * @param mixed $default |
832 | 832 | * @return mixed |
833 | 833 | */ |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | * > last([]) |
850 | 850 | * null |
851 | 851 | * |
852 | - * @param array|string|\Iterator $iterable |
|
852 | + * @param lib\Traits\LastTrait $iterable |
|
853 | 853 | * @param mixed $default |
854 | 854 | * @return mixed |
855 | 855 | */ |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | function type($class, $strategy = null) |
29 | 29 | { |
30 | 30 | $strategy = conversions\mixed_to_value_getter($strategy); |
31 | - return function ($value, $key = null) use ($class, $strategy) { |
|
31 | + return function($value, $key = null) use ($class, $strategy) { |
|
32 | 32 | return $strategy($value, $key) instanceof $class; |
33 | 33 | }; |
34 | 34 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | $haystack = iter\iterable($haystack)->values(); |
59 | 59 | } |
60 | 60 | $strategy = conversions\mixed_to_value_getter($strategy); |
61 | - return function ($value, $key = null) use ($haystack, $strategy, $strict) { |
|
61 | + return function($value, $key = null) use ($haystack, $strategy, $strict) { |
|
62 | 62 | return in_array($strategy($value, $key), $haystack, $strict); |
63 | 63 | }; |
64 | 64 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $haystack = iter\iterable($haystack)->values(); |
81 | 81 | } |
82 | 82 | $strategy = conversions\mixed_to_value_getter($strategy); |
83 | - return function ($value, $key = null) use ($haystack, $strategy, $strict) { |
|
83 | + return function($value, $key = null) use ($haystack, $strategy, $strict) { |
|
84 | 84 | return !in_array($strategy($value, $key), $haystack, $strict); |
85 | 85 | }; |
86 | 86 | } |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | } |
109 | 109 | $strategy = conversions\mixed_to_value_getter($strategy); |
110 | 110 | if ($strict) { |
111 | - return function ($value, $key = null) use ($expected, $strategy) { |
|
111 | + return function($value, $key = null) use ($expected, $strategy) { |
|
112 | 112 | return $expected === $strategy($value, $key); |
113 | 113 | }; |
114 | 114 | } else { |
115 | - return function ($value, $key = null) use ($expected, $strategy) { |
|
115 | + return function($value, $key = null) use ($expected, $strategy) { |
|
116 | 116 | return $expected == $strategy($value, $key); |
117 | 117 | }; |
118 | 118 | } |