1 | <?php |
||
20 | trait ProviderAttributesTrait |
||
21 | { |
||
22 | use ProviderClientAttributesTrait, |
||
23 | ProviderEnvironmentAttributesTrait; |
||
24 | |||
25 | /** |
||
26 | * @var bool|null The enabled state |
||
27 | */ |
||
28 | public $enabled = true; |
||
29 | |||
30 | /** |
||
31 | * @var int|int[]|false|null The model ID(s). Prefix IDs with "not " to exclude them. |
||
32 | */ |
||
33 | public $id; |
||
34 | |||
35 | /** |
||
36 | * @var string|string[]|null The provider name(s). Prefix IDs with "not " to exclude them. |
||
37 | */ |
||
38 | public $name; |
||
39 | |||
40 | /** |
||
41 | * @var string|string[]|null The provider handle(s). Prefix IDs with "not " to exclude them. |
||
42 | */ |
||
43 | public $handle; |
||
44 | |||
45 | /** |
||
46 | * @param $enabled |
||
47 | * @return $this |
||
48 | */ |
||
49 | public function enabled($enabled) |
||
54 | |||
55 | /** |
||
56 | * @param $id |
||
57 | * @return $this |
||
58 | */ |
||
59 | public function id($id) |
||
64 | |||
65 | /** |
||
66 | * @param $name |
||
67 | * @return $this |
||
68 | */ |
||
69 | public function name($name) |
||
74 | |||
75 | /** |
||
76 | * @param $handle |
||
77 | * @return $this |
||
78 | */ |
||
79 | public function handle($handle) |
||
84 | |||
85 | /** |
||
86 | * @throws QueryAbortedException |
||
87 | */ |
||
88 | protected function applyProviderConditions() |
||
111 | |||
112 | /******************************************* |
||
113 | * PARAMS |
||
114 | *******************************************/ |
||
115 | |||
116 | /** |
||
117 | * Apply environment params |
||
118 | */ |
||
119 | protected function applyInstanceConditions() |
||
138 | } |
||
139 |
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.