| 1 | <?php |
||
| 9 | class Builder |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * WP_Query instance |
||
| 13 | * @var \WP_Query |
||
| 14 | */ |
||
| 15 | protected $query; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Post Model instance |
||
| 19 | * @var \Silk\Models\Post |
||
| 20 | */ |
||
| 21 | protected $model; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * Builder constructor. |
||
| 25 | * |
||
| 26 | * @param WP_Query $query |
||
| 27 | */ |
||
| 28 | public function __construct(WP_Query $query) |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Limit the number of returned results |
||
| 35 | * |
||
| 36 | * @param integer $limit The maximum number of results to return |
||
| 37 | * use -1 for no limit |
||
| 38 | * |
||
| 39 | * @return $this |
||
| 40 | */ |
||
| 41 | public function limit($limit) |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Get the results as a collection of post model instances |
||
| 50 | * |
||
| 51 | * @return Collection |
||
| 52 | */ |
||
| 53 | public function results() |
||
| 67 | |||
| 68 | /** |
||
| 69 | * Set the model for this query. |
||
| 70 | * |
||
| 71 | * @param Post $model |
||
| 72 | * |
||
| 73 | * @return $this |
||
| 74 | */ |
||
| 75 | public function setModel(Post $model) |
||
| 81 | |||
| 82 | /** |
||
| 83 | * Get the model |
||
| 84 | * |
||
| 85 | * @return Post |
||
| 86 | */ |
||
| 87 | public function getModel() |
||
| 91 | |||
| 92 | } |
||
| 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.