1 | <?php |
||
20 | trait AccessTokenTrait |
||
21 | { |
||
22 | /** |
||
23 | * Generate a JWT from the access token |
||
24 | * |
||
25 | * @param CryptKey $privateKey |
||
26 | * |
||
27 | * @return Token |
||
28 | */ |
||
29 | 9 | public function convertToJWT(CryptKey $privateKey) |
|
42 | |||
43 | /** |
||
44 | * Generate a string representation from the access token |
||
45 | * |
||
46 | * @param CryptKey $privateKey |
||
47 | * |
||
48 | * @return string |
||
49 | */ |
||
50 | 9 | public function convertToAccessToken(CryptKey $privateKey) |
|
54 | |||
55 | /** |
||
56 | * @return ClientEntityInterface |
||
57 | */ |
||
58 | abstract public function getClient(); |
||
59 | |||
60 | /** |
||
61 | * @return \DateTime |
||
62 | */ |
||
63 | abstract public function getExpiryDateTime(); |
||
64 | |||
65 | /** |
||
66 | * @return string|int |
||
67 | */ |
||
68 | abstract public function getUserIdentifier(); |
||
69 | |||
70 | /** |
||
71 | * @return ScopeEntityInterface[] |
||
72 | */ |
||
73 | abstract public function getScopes(); |
||
74 | } |
||
75 |
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.