Completed
Pull Request — master (#166)
by
unknown
13:08 queued 10:56
created

Recursive::__invoke()   A

Complexity

Conditions 3
Paths 1

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 3
nc 1
nop 0
1
<?php
2
3
namespace Spatie\CollectionMacros\Macros;
4
5
/**
6
 * Use to deep collect multi-dimensional associative arrays.
7
 */
8
class Recursive
9
{
10
	public function __invoke()
11
	{
12
		return function () {
13
			return $this->map(function ($value) {
0 ignored issues
show
Bug introduced by
The method map() does not seem to exist on object<Spatie\CollectionMacros\Macros\Recursive>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
14
				if (is_array($value) || is_object($value)) {
15
					return collect($value)->recursive();
16
				}
17
18
				return $value;
19
			});
20
		};
21
	}
22
}