$roles */ public function __construct( ?string $providerKey, private ?string $authenticatingService = null, $user = null, private string $credentials = '', array $roles = [], private ?Response $response = null ) { parent::__construct($roles); if ('' === $providerKey) { throw new \InvalidArgumentException('$providerKey must not be empty.'); } if (null !== $user) { $this->setUser($user); } $this->providerKey = $providerKey; $this->setAuthenticated(count($roles) > 0); } public function getCredentials(): string { return $this->credentials; } public function getProviderKey(): ?string { return $this->providerKey; } public function getAuthenticatingService(): ?string { return $this->authenticatingService; } public function getResponse(): ?Response { return $this->response; } /** * @return array */ public function __serialize(): array { return array_merge([$this->authenticatingService, $this->credentials, $this->providerKey, parent::__serialize()]); } /** * @param array $data */ public function __unserialize(array $data): void { [$this->authenticatingService, $this->credentials, $this->providerKey, $parentArray] = $data; parent::__unserialize($parentArray); } }