id = $id; $this->createdAt = $createdAt; $this->locked = $locked; $this->identifier = $identifier; $this->nickname = $nickname; $this->label = $label; $this->role = $role; $this->tokens = $tokens; $this->sessions = $sessions; } public function getId(): ?string { return $this->id; } public function getCreatedAt(): ?string { return $this->createdAt; } public function isLocked(): bool { return $this->locked; } public function getIdentifier(): ?string { return $this->identifier; } public function getNickname(): ?string { return $this->nickname; } public function getLabel(): ?string { return $this->label; } // For BC compatibility, getLabel() should be used public function getName(): ?string { return $this->label; } public function getRole(): string { return $this->role; } /** * @return Token[] */ public function getTokens(): array { return $this->tokens; } /** * @return Session[] */ public function getSessions(): array { return $this->sessions; } public static function fromArray(array $array = []): Identity { $id = $array['id'] ?? null; $createdAt = $array['createdAt'] ?? null; $locked = $array['locked'] ?? false; $identifier = $array['identifier'] ?? null; $nickname = $array['nickname'] ?? null; $label = $array['label'] ?? null; $role = $array['role'] ?? null; $tokens = []; foreach ($array['tokens'] as $item) { $tokens[] = Token::fromArray($item); } $sessions = []; foreach ($array['sessions'] as $item) { $sessions[] = Session::fromArray($item); } return new Identity($id, $createdAt, $locked, $identifier, $nickname, $label, $role, $tokens, $sessions); } }