Skip to content

Commit 990fb63

Browse files
committed
Refactoring
1 parent 126e319 commit 990fb63

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

examples/messaging.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
$testToken = '123456789';
1111

1212
$client = new Client($serviceAccountPath);
13-
$client->applyCredentials();
1413

1514
$recipient = new Device($testToken);
1615

src/Client.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public function __construct(string $serviceAccountPath)
2121

2222
$this->serviceAccountPath = $serviceAccountPath;
2323
$this->guzzleClient = new \GuzzleHttp\Client();
24+
$this->applyCredentials();
2425
}
2526

2627
public function setServiceAccountPath(string $serviceAccountPath): self
@@ -30,10 +31,11 @@ public function setServiceAccountPath(string $serviceAccountPath): self
3031
}
3132

3233
$this->serviceAccountPath = $serviceAccountPath;
34+
$this->applyCredentials();
3335
return $this;
3436
}
3537

36-
public function applyCredentials(): self
38+
private function applyCredentials(): self
3739
{
3840
$this->projectId = \json_decode(file_get_contents($this->serviceAccountPath), true)['project_id'];
3941
$this->accessToken = $this->getAccessToken();

src/ClientInterface.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@ interface ClientInterface
99
public function setServiceAccountPath(string $serviceAccountPath): self;
1010

1111
public function send(Notification $message): ResponseInterface;
12-
13-
public function applyCredentials(): self;
1412
}

0 commit comments

Comments
 (0)