1 | <?php |
||
23 | trait TokenProviderAttributeTrait |
||
24 | { |
||
25 | /** |
||
26 | * The provider(s) that the resulting must have. |
||
27 | * |
||
28 | * @var string|string[]|int|int[]|ProviderRecord|ProviderRecord[]|AbstractProvider|AbstractProvider[]|null |
||
29 | */ |
||
30 | public $provider; |
||
31 | |||
32 | /** |
||
33 | * @param string|string[]|int|int[]|ProviderRecord|ProviderRecord[]|AbstractProvider|AbstractProvider[]|null $value |
||
34 | * @return static The query object |
||
35 | */ |
||
36 | public function setProvider($value) |
||
41 | |||
42 | /** |
||
43 | * @param string|string[]|int|int[]|ProviderRecord|ProviderRecord[]|AbstractProvider|AbstractProvider[]|null $value |
||
44 | * @return static The query object |
||
45 | */ |
||
46 | public function provider($value) |
||
50 | |||
51 | /** |
||
52 | * @param string|string[]|int|int[]|ProviderRecord|ProviderRecord[]|AbstractProvider|AbstractProvider[]|null $value |
||
53 | * @return static The query object |
||
54 | */ |
||
55 | public function setProviderId($value) |
||
59 | |||
60 | /** |
||
61 | * @param string|string[]|int|int[]|ProviderRecord|ProviderRecord[]|AbstractProvider|AbstractProvider[]|null $value |
||
62 | * @return static The query object |
||
63 | */ |
||
64 | public function providerId($value) |
||
68 | |||
69 | /** |
||
70 | * @param $value |
||
71 | * @param string $join |
||
72 | * @return array |
||
73 | * @throws \ReflectionException |
||
74 | */ |
||
75 | protected function parseProviderValue($value, string $join = 'or'): array |
||
94 | |||
95 | /** |
||
96 | * @param $operator |
||
97 | * @param $value |
||
98 | * @throws \ReflectionException |
||
99 | */ |
||
100 | protected function resolveProviderValue($operator, &$value) |
||
120 | |||
121 | /** |
||
122 | * @param string $value |
||
123 | * @return int|null |
||
124 | */ |
||
125 | protected function resolveProviderStringValue(string $value) |
||
141 | |||
142 | /** |
||
143 | * @throws \ReflectionException |
||
144 | */ |
||
145 | protected function applyProviderConditions() |
||
155 | } |
||
156 |
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.