Conditions | 1 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
26 | public function convertToJWT(CryptKey $privateKey) |
||
27 | { |
||
28 | return (new Builder()) |
||
29 | ->setAudience($this->getClient()->getIdentifier()) |
||
|
|||
30 | ->setId($this->getIdentifier(), true) |
||
31 | ->setIssuedAt(time()) |
||
32 | ->setNotBefore(time()) |
||
33 | ->setExpiration($this->getExpiryDateTime()->getTimestamp()) |
||
34 | ->setSubject($this->getUserIdentifier()) |
||
35 | ->set('scopes', $this->getScopes()) |
||
36 | ->sign(new Sha256(), new Key($privateKey->getKeyPath(), $privateKey->getPassPhrase())) |
||
37 | ->getToken(); |
||
38 | } |
||
39 | } |
||
40 |
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.