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