File tree Expand file tree Collapse file tree 2 files changed +18
-16
lines changed Expand file tree Collapse file tree 2 files changed +18
-16
lines changed Original file line number Diff line number Diff line change @@ -48,4 +48,21 @@ function get_from_array(array $map, string $node)
48
48
return null ;
49
49
}
50
50
51
+ }
52
+
53
+ if (!function_exists ('is_collection ' )) {
54
+ /**
55
+ * Check given value is multidimensional array
56
+ *
57
+ * @param array $arr
58
+ * @return bool
59
+ */
60
+ function is_collection (array $ arr ) : bool
61
+ {
62
+ if (!is_array ($ arr )) {
63
+ return false ;
64
+ }
65
+
66
+ return isset ($ arr [0 ]) && is_array ($ arr [0 ]);
67
+ }
51
68
}
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ public function transformer()
43
43
*/
44
44
public function handle () : array
45
45
{
46
- if ($ this -> isCollection ($ this ->data )) {
46
+ if (is_collection ($ this ->data )) {
47
47
$ generatedData = [];
48
48
foreach ($ this ->data as $ property => $ data ) {
49
49
$ generatedData [$ property ] = $ this ->transform ($ this ->process ($ data ));
@@ -124,19 +124,4 @@ public function get() : array
124
124
{
125
125
return $ this ->generatedData ;
126
126
}
127
-
128
- /**
129
- * Check given value is multidimensional array
130
- *
131
- * @param array $arr
132
- * @return bool
133
- */
134
- protected function isCollection (array $ arr ) : bool
135
- {
136
- if (!is_array ($ arr )) {
137
- return false ;
138
- }
139
-
140
- return isset ($ arr [0 ]) && is_array ($ arr [0 ]);
141
- }
142
127
}
You can’t perform that action at this time.
0 commit comments