Conditions | 2 |
Paths | 1 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function __invoke() |
||
17 | { |
||
18 | return function ($keys): Collection { |
||
19 | $keys = is_array($keys) ? $keys : func_get_args(); |
||
20 | |||
21 | return array_reduce($keys, function ($extracted, $key) { |
||
22 | return $extracted->push( |
||
23 | data_get($this->items, $key) |
||
|
|||
24 | ); |
||
25 | }, new static()); |
||
26 | }; |
||
27 | } |
||
28 | } |
||
29 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: