1 | <?php |
||
26 | trait WhereProvider |
||
27 | { |
||
28 | use WhereInProvider; |
||
29 | use WhereLikeProvider; |
||
30 | use WhereNullProvider; |
||
31 | use WhereBetweenProvider; |
||
32 | |||
33 | /** |
||
34 | * - AND if true |
||
35 | * - OR if false |
||
36 | * |
||
37 | * @var bool |
||
38 | */ |
||
39 | protected $conjunction = true; |
||
40 | |||
41 | /** |
||
42 | * @param \Closure|null $group |
||
43 | * @return Query|$this|self |
||
44 | */ |
||
45 | 17 | public function or(\Closure $group = null): self |
|
55 | |||
56 | /** |
||
57 | * @param \Closure|null $group |
||
58 | * @return Query|$this|self |
||
59 | */ |
||
60 | 1 | public function and(\Closure $group = null): self |
|
70 | |||
71 | /** |
||
72 | * @param string|\Closure $field |
||
73 | * @param $valueOrOperator |
||
74 | * @param null $value |
||
75 | * @return Query|$this|self |
||
76 | */ |
||
77 | 11 | public function orWhere($field, $valueOrOperator = null, $value = null): self |
|
81 | |||
82 | /** |
||
83 | * @param string|\Closure $field |
||
84 | * @param $valueOrOperator |
||
85 | * @param null $value |
||
86 | * @return Query|$this|self |
||
87 | */ |
||
88 | 25 | public function where($field, $valueOrOperator = null, $value = null): self |
|
106 | |||
107 | |||
108 | /** |
||
109 | * @return bool |
||
110 | */ |
||
111 | protected function mode(): bool |
||
117 | } |
||
118 |
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.