1 | <?php |
||
21 | trait AccessTokenTrait |
||
22 | { |
||
23 | /** |
||
24 | * Generate a JWT from the access token |
||
25 | * |
||
26 | * @param CryptKey $privateKey |
||
27 | * |
||
28 | * @return Token |
||
29 | */ |
||
30 | 9 | public function convertToJWT(CryptKey $privateKey) |
|
39 | |||
40 | /** |
||
41 | * @return ClientEntityInterface |
||
42 | */ |
||
43 | abstract public function getClient(); |
||
44 | |||
45 | /** |
||
46 | * @return DateTime |
||
47 | */ |
||
48 | abstract public function getExpiryDateTime(); |
||
49 | |||
50 | /** |
||
51 | * @return string|int |
||
52 | */ |
||
53 | abstract public function getUserIdentifier(); |
||
54 | |||
55 | /** |
||
56 | * @return ScopeEntityInterface[] |
||
57 | */ |
||
58 | abstract public function getScopes(); |
||
59 | |||
60 | /** |
||
61 | * Set data parameters to token builder. |
||
62 | * |
||
63 | * @param Builder $builder |
||
64 | */ |
||
65 | 9 | protected function setDataToBuilder(Builder $builder) |
|
76 | |||
77 | /** |
||
78 | * Sign data in token builder. |
||
79 | * |
||
80 | * @param Builder $builder |
||
81 | */ |
||
82 | 9 | protected function signDataInBuider(Builder $builder, CryptKey $privateKey) |
|
89 | } |
||
90 |
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.