id = $id; $this->userId = $userId; $this->identifier = $identifier; $this->refreshToken = $refreshToken; } /** * @param array $dataSet * * @return GoogleAccountData */ public static function fromDbState($dataSet): GoogleAccountData { if (!isset($dataSet['user_id'], $dataSet['id'])) { throw new InvalidArgumentException('Invalid or incomplete Dataset.'); } return new self( $dataSet['id'], $dataSet['user_id'], $dataSet['identifier'], $dataSet['refresh_token'] ); } /** * @return array */ public function toArray(): array { return [ 'id' => $this->getId(), 'user_id' => $this->getUserId(), 'identifier' => $this->getIdentifier(), 'refresh_token' => $this->getRefreshToken(), ]; } /** * @return int|null */ public function getId(): ?int { return $this->id; } /** * @return int */ public function getUserId(): int { return $this->userId; } /** * @return string|null */ public function getRefreshToken(): ?string { return $this->refreshToken; } /** * @return string|null */ public function getIdentifier(): ?string { return $this->identifier; } }