| 1 | <?php namespace Spatie\CollectionMacros\Macros;  | 
            ||
| 6 | class Extract  | 
            ||
| 7 | { | 
            ||
| 8 | /*  | 
            ||
| 9 | * Extract keys from a collection, like `only`, except:  | 
            ||
| 10 | * - If a value doesn't exist, it returns null instead of omitting it  | 
            ||
| 11 | * - It returns a collection without keys, so `list()` can be used.  | 
            ||
| 12 | *  | 
            ||
| 13 | * @return \Illuminate\Support\Collection  | 
            ||
| 14 | */  | 
            ||
| 15 | public function extract()  | 
            ||
| 25 | }  | 
            ||
| 26 | 
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: