*/ public $meta; /** * For Facebook: the list of Pages the admin can choose to connect. * Each element represents one available Facebook Page. * * @var self[] */ public $availablePages; /** * @param array $meta * @param self[] $availablePages */ public function __construct( string $network, string $externalId, string $name, string $username, ?string $avatarUrl, string $authType, string $accessToken, ?\DateTimeImmutable $tokenExpiresAt, array $meta = [], array $availablePages = [] ) { $this->network = $network; $this->externalId = $externalId; $this->name = $name; $this->username = $username; $this->avatarUrl = $avatarUrl; $this->authType = $authType; $this->accessToken = $accessToken; $this->tokenExpiresAt = $tokenExpiresAt; $this->meta = $meta; $this->availablePages = $availablePages; } /** * Returns the plaintext access token. Callers must encrypt before persisting. */ public function getAccessToken(): string { return $this->accessToken; } /** * Masks the access token and page tokens when the object is dumped for * debugging (PHP's dump functions, Xdebug, etc.). * * @return array */ public function __debugInfo(): array { return [ 'network' => $this->network, 'externalId' => $this->externalId, 'name' => $this->name, 'username' => $this->username, 'avatarUrl' => $this->avatarUrl, 'authType' => $this->authType, 'accessToken' => '***', 'tokenExpiresAt' => $this->tokenExpiresAt, 'meta' => $this->meta, 'availablePages' => sprintf( '[%d page(s) — tokens masked]', count( $this->availablePages ) ), ]; } }