| Conditions | 2 |
| Paths | 1 |
| Total Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public static function collection($resource) |
||
| 19 | { |
||
| 20 | return tap(new AnonymousPaginationResultAwareResourceCollection($resource, static::class), function ($collection) { |
||
| 21 | if (property_exists(static::class, 'preserveKeys')) { |
||
| 22 | $collection->preserveKeys = (new static([]))->preserveKeys === true; |
||
| 23 | } |
||
| 24 | }); |
||
| 25 | } |
||
| 26 | } |
||
| 27 |
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: