| Conditions | 3 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 53 | public function results() |
||
| 54 | { |
||
| 55 | if ($this->model) { |
||
| 56 | $this->query->set('post_type', $this->model->post_type); |
||
|
|
|||
| 57 | $this->query->set('fields', ''); // return objects |
||
| 58 | } |
||
| 59 | |||
| 60 | $collection = Collection::make($this->query->get_posts()); |
||
| 61 | $modelClass = $this->model ? get_class($this->model) : Post::class; |
||
| 62 | |||
| 63 | return $collection->transform(function($post) use ($modelClass) { |
||
| 64 | return new $modelClass($post); |
||
| 65 | }); |
||
| 66 | } |
||
| 67 | |||
| 93 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.