[PLUGIN][OAuth2] Fix some static issues

This commit is contained in:
2022-02-04 18:34:08 +00:00
parent 4dd976eb22
commit 81f6d496c6
15 changed files with 206 additions and 202 deletions

View File

@@ -34,6 +34,7 @@ namespace Plugin\OAuth2\Entity;
use DateTimeInterface;
use League\OAuth2\Server\CryptKey;
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
use Plugin\OAuth2\Util\Token;
class AccessToken extends Token implements AccessTokenEntityInterface
{
@@ -47,20 +48,14 @@ class AccessToken extends Token implements AccessTokenEntityInterface
private bool $revoked;
private DateTimeInterface $created;
public function setId(string $id): self
{
$this->id = mb_substr($id, 0, 64);
return $this;
}
public function getId(): string
{
return $this->id;
}
public function setExpiry(DateTimeInterface $expiry): self
public function setId(string $id): self
{
$this->expiry = $expiry;
$this->id = mb_substr($id, 0, 64);
return $this;
}
@@ -69,9 +64,9 @@ class AccessToken extends Token implements AccessTokenEntityInterface
return $this->expiry;
}
public function setUserId(?int $user_id): self
public function setExpiry(DateTimeInterface $expiry): self
{
$this->user_id = $user_id;
$this->expiry = $expiry;
return $this;
}
@@ -80,9 +75,9 @@ class AccessToken extends Token implements AccessTokenEntityInterface
return $this->user_id;
}
public function setClientId(string $client_id): self
public function setUserId(?int $user_id): self
{
$this->client_id = mb_substr($client_id, 0, 64);
$this->user_id = $user_id;
return $this;
}
@@ -91,9 +86,9 @@ class AccessToken extends Token implements AccessTokenEntityInterface
return $this->client_id;
}
public function setTokenScopes(string $token_scopes): self
public function setClientId(string $client_id): self
{
$this->token_scopes = $token_scopes;
$this->client_id = mb_substr($client_id, 0, 64);
return $this;
}
@@ -102,9 +97,9 @@ class AccessToken extends Token implements AccessTokenEntityInterface
return $this->token_scopes;
}
public function setRevoked(bool $revoked): self
public function setTokenScopes(string $token_scopes): self
{
$this->revoked = $revoked;
$this->token_scopes = $token_scopes;
return $this;
}
@@ -113,9 +108,9 @@ class AccessToken extends Token implements AccessTokenEntityInterface
return $this->revoked;
}
public function setCreated(DateTimeInterface $created): self
public function setRevoked(bool $revoked): self
{
$this->created = $created;
$this->revoked = $revoked;
return $this;
}
@@ -124,13 +119,19 @@ class AccessToken extends Token implements AccessTokenEntityInterface
return $this->created;
}
public function setCreated(DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
// @codeCoverageIgnoreEnd
// }}} Autocode
public CryptKey $private_key;
public function setPrivateKey(CryptKey $private_key)
public function setPrivateKey(CryptKey $privateKey)
{
$this->private_key = $private_key;
$this->private_key = $privateKey;
}
public function __toString()