These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace AdvancedLearning\Oauth2Server\Repositories; |
||
4 | |||
5 | use AdvancedLearning\Oauth2Server\Entities\AccessToken; |
||
6 | use AdvancedLearning\Oauth2Server\Models\AccessToken as AccessTokenModel; |
||
7 | use League\OAuth2\Server\Entities\AccessTokenEntityInterface; |
||
8 | use League\OAuth2\Server\Entities\ClientEntityInterface; |
||
9 | use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface; |
||
10 | |||
11 | class AccessTokenRepository implements AccessTokenRepositoryInterface |
||
12 | { |
||
13 | /** |
||
14 | * {@inheritdoc} |
||
15 | */ |
||
16 | public function persistNewAccessToken(AccessTokenEntityInterface $accessTokenEntity) |
||
17 | { |
||
18 | $newToken = AccessTokenModel::create(); |
||
19 | |||
20 | $newToken->Identifier = $accessTokenEntity->getIdentifier(); |
||
21 | $newToken->MemberID = $accessTokenEntity->getClient()->getIdentifier(); |
||
0 ignored issues
–
show
|
|||
22 | $newToken->Name = $accessTokenEntity->getClient()->getName(); |
||
23 | $newToken->ExpiryDateTime = $accessTokenEntity->getExpiryDateTime()->format('Y-m-d H:i'); |
||
0 ignored issues
–
show
The property
ExpiryDateTime does not seem to exist. Did you mean ExpiryDatetime ?
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.
Loading history...
|
|||
24 | |||
25 | // turn scopes into space separated string |
||
26 | $newToken->Scopes = ''; |
||
27 | $separator = ''; |
||
28 | foreach ($accessTokenEntity->getScopes() as $scope) { |
||
29 | $newToken->Scopes .= $separator . $scope->getIdentifier(); |
||
30 | $separator = ' '; |
||
31 | } |
||
32 | |||
33 | $newToken->write(); |
||
34 | |||
35 | return $newToken; |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * {@inheritdoc} |
||
40 | */ |
||
41 | public function getNewToken(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null) |
||
42 | { |
||
43 | return new AccessToken($userIdentifier, $scopes); |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | public function revokeAccessToken($tokenId) |
||
50 | { |
||
51 | if ($token = $this->findToken($tokenId)) { |
||
52 | $token->Revoked = true; |
||
53 | $token->write(); |
||
54 | } |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * {@inheritdoc} |
||
59 | */ |
||
60 | public function isAccessTokenRevoked($tokenId) |
||
61 | { |
||
62 | $token = $this->findToken($tokenId); |
||
63 | |||
64 | // return true if there is no matching token |
||
65 | return !$token || $token->Revoked; |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * Find the Token for passed id. |
||
70 | * |
||
71 | * @param mixed $tokenId The id of the token. |
||
72 | * |
||
73 | * @return AccessTokenModel |
||
74 | */ |
||
75 | public function findToken($tokenId) |
||
76 | { |
||
77 | return AccessTokenModel::get()->byID($tokenId); |
||
78 | } |
||
79 | } |
||
80 |
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.