User::class]; private static array $possibleScopeValues = ['openid', 'email', 'profile']; private array $scope = []; private string $nonce = ''; private ?User $user = null; private ?int $userId = null; private string $code = ''; private string $accessToken = ''; private DateTime $created; private DateTime $expires; public function setScopeArray(array $scope): void { $this->scope = array_intersect($scope, self::$possibleScopeValues); } public function setScope(string $scope): void { $this->setScopeArray(explode(' ', $scope)); } public function setNonce(string $nonce): void { $this->nonce = $nonce; } public function setUser(User $user): void { $this->user = $user; } public function setUserId(int $userId): void { $this->userId = $userId; } public function setCode(string $code): void { $this->code = $code; } public function setAccessToken(string $accessToken): void { $this->accessToken = $accessToken; } public function setCreatedDate(DateTime $created): void { $this->created = $created; } public function setExpiresDate(DateTime $expires): void { $this->expires = $expires; } public function setCreated(string $created): void { $this->created = new DateTime($created); } public function setExpires(string $expires): void { $this->expires = new DateTime($expires); } public function getScope(): string { return implode(' ', $this->scope); } public function getScopeArray(): array { return $this->scope; } public function getNonce(): string { return $this->nonce; } public function getUser(): ?User { return $this->user; } public function getUserId(): ?int { return $this->userId; } public function getCode(): string { return $this->code; } public function getAccessToken(): string { return $this->accessToken; } public function getCreatedDate(): DateTime { return $this->created; } public function getCreated(): string { return $this->created->format('Y-m-d H:i:s'); } public function getExpiresDate(): DateTime { return $this->expires; } public function getExpires(): string { return $this->expires->format('Y-m-d H:i:s'); } }