1 | <?php |
||
20 | trait ExecutionsProvider |
||
21 | { |
||
22 | /** |
||
23 | * @param string ...$fields |
||
24 | * @return object[]|iterable |
||
25 | */ |
||
26 | 20 | public function get(string ...$fields): iterable |
|
46 | |||
47 | /** |
||
48 | * Get the values of a given key. |
||
49 | * |
||
50 | * @param string|array $value |
||
51 | * @param string|null $key |
||
52 | * @return Collection|iterable |
||
53 | */ |
||
54 | public function pluck($value, $key = null): Collection |
||
60 | |||
61 | /** |
||
62 | * @param string $field |
||
63 | * @param string|null $typeOf |
||
64 | * @return mixed |
||
65 | * @throws \LogicException |
||
66 | */ |
||
67 | 10 | public function scalar(string $field, string $typeOf = null) |
|
80 | |||
81 | /** |
||
82 | * @param mixed $result |
||
83 | * @param string $typeOf |
||
84 | * @return array|\Closure|object |
||
85 | */ |
||
86 | 10 | private function cast($result, string $typeOf) |
|
112 | |||
113 | /** |
||
114 | * @param string|null $field |
||
115 | * @return int |
||
116 | * @throws \LogicException |
||
117 | */ |
||
118 | 2 | public function count(?string $field = 'id'): int |
|
123 | |||
124 | /** |
||
125 | * @param string|null $field |
||
126 | * @return int |
||
127 | * @throws \LogicException |
||
128 | */ |
||
129 | 2 | public function sum(string $field = null): int |
|
134 | |||
135 | /** |
||
136 | * @param string|null $field |
||
137 | * @return int |
||
138 | * @throws \LogicException |
||
139 | */ |
||
140 | 2 | public function avg(string $field = null): int |
|
145 | |||
146 | /** |
||
147 | * @param string|null $field |
||
148 | * @return int |
||
149 | * @throws \LogicException |
||
150 | */ |
||
151 | 2 | public function max(string $field = null): int |
|
156 | |||
157 | /** |
||
158 | * @param string|null $field |
||
159 | * @return int |
||
160 | * @throws \LogicException |
||
161 | */ |
||
162 | 2 | public function min(string $field = null): int |
|
167 | |||
168 | /** |
||
169 | * @param string ...$fields |
||
170 | * @return Collection |
||
171 | */ |
||
172 | 2 | public function collect(string ...$fields): Collection |
|
176 | |||
177 | /** |
||
178 | * @param string[] $fields |
||
179 | * @return object|null |
||
180 | * @throws \LogicException |
||
181 | */ |
||
182 | public function first(string ...$fields) |
||
186 | } |
||
187 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.