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 | * @var string|string[]|null The provider classes(s). Prefix IDs with "not " to exclude them. |
||
47 | */ |
||
48 | public $class; |
||
49 | |||
50 | /** |
||
51 | * @param $enabled |
||
52 | * @return $this |
||
53 | */ |
||
54 | public function enabled($enabled) |
||
59 | |||
60 | /** |
||
61 | * @param $id |
||
62 | * @return $this |
||
63 | */ |
||
64 | public function id($id) |
||
69 | |||
70 | /** |
||
71 | * @param $name |
||
72 | * @return $this |
||
73 | */ |
||
74 | public function name($name) |
||
79 | |||
80 | /** |
||
81 | * @param $handle |
||
82 | * @return $this |
||
83 | */ |
||
84 | public function handle($handle) |
||
89 | |||
90 | /** |
||
91 | * @param $class |
||
92 | * @return $this |
||
93 | */ |
||
94 | public function class($class) |
||
99 | |||
100 | /** |
||
101 | * @throws QueryAbortedException |
||
102 | */ |
||
103 | protected function applyProviderConditions() |
||
126 | |||
127 | /******************************************* |
||
128 | * PARAMS |
||
129 | *******************************************/ |
||
130 | |||
131 | /** |
||
132 | * Apply environment params |
||
133 | */ |
||
134 | protected function applyInstanceConditions() |
||
153 | } |
||
154 |
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.