1 | <?php |
||
9 | abstract class Builder implements BuildsQueries |
||
10 | { |
||
11 | /** |
||
12 | * The query instance |
||
13 | * @var object The query instance |
||
14 | */ |
||
15 | protected $query; |
||
16 | |||
17 | /** |
||
18 | * @var Model|null The model instance if set, otherwise null |
||
19 | */ |
||
20 | protected $model; |
||
21 | |||
22 | /** |
||
23 | * Execute the query and return the raw results. |
||
24 | * |
||
25 | * @return array |
||
26 | */ |
||
27 | abstract protected function query(); |
||
28 | |||
29 | /** |
||
30 | * Get the results as a collection |
||
31 | * |
||
32 | * @return Collection |
||
33 | */ |
||
34 | public function results() |
||
42 | |||
43 | /** |
||
44 | * Get the results as a collection of model instances. |
||
45 | * |
||
46 | * @return Collection |
||
47 | */ |
||
48 | protected function collectModels() |
||
57 | |||
58 | /** |
||
59 | * Set the model for this query. |
||
60 | * |
||
61 | * @param Model $model |
||
62 | * |
||
63 | * @return $this |
||
64 | */ |
||
65 | public function setModel(Model $model) |
||
71 | |||
72 | /** |
||
73 | * Get the model |
||
74 | * |
||
75 | * @return Model |
||
|
|||
76 | */ |
||
77 | public function getModel() |
||
81 | |||
82 | /** |
||
83 | * Get the query object. |
||
84 | * |
||
85 | * @return object |
||
86 | */ |
||
87 | public function getQuery() |
||
91 | |||
92 | /** |
||
93 | * Handle dynamic method calls on the builder. |
||
94 | * |
||
95 | * @param string $name Method name |
||
96 | * @param array $arguments |
||
97 | * |
||
98 | * @return mixed |
||
99 | */ |
||
100 | public function __call($name, $arguments) |
||
108 | } |
||
109 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.