Conditions | 2 |
Paths | 1 |
Total Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | public function __invoke() { |
||
17 | return function ($keys): Collection { |
||
18 | $keys = is_array($keys) ? $keys : func_get_args(); |
||
19 | |||
20 | return array_reduce($keys, function ($extracted, $key) { |
||
21 | return $extracted->push( |
||
22 | data_get($this->items, $key) |
||
|
|||
23 | ); |
||
24 | }, new static()); |
||
25 | }; |
||
26 | } |
||
27 | } |
||
28 |
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: