Skip to content
This repository was archived by the owner on Jun 28, 2024. It is now read-only.

Commit 3c8435e

Browse files
committed
Remove config property from BaseRequest and replace it by serverKey and senderId properties
1 parent 0dc756e commit 3c8435e

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/Request/BaseRequest.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,38 @@ abstract class BaseRequest
1414
/**
1515
* @internal
1616
*
17-
* @var array
17+
* @var string
1818
*/
19-
protected $config;
19+
protected $serverKey;
20+
21+
/**
22+
* @internal
23+
*
24+
* @var string
25+
*/
26+
protected $senderId;
2027

2128
/**
2229
* BaseRequest constructor.
2330
*/
2431
public function __construct()
2532
{
26-
$this->config = app('config')->get('fcm.http', []);
33+
$config = app('config')->get('fcm.http', []);
34+
$this->serverKey = $config['server_key'];
35+
$this->senderId = $config['sender_id'];
2736
}
2837

2938
/**
3039
* Build the header for the request.
3140
*
32-
* @return array
41+
* @return array<string,string>
3342
*/
3443
protected function buildRequestHeader()
3544
{
3645
return [
37-
'Authorization' => 'key=' . $this->config['server_key'],
46+
'Authorization' => 'key=' . $this->serverKey,
3847
'Content-Type' => 'application/json',
39-
'project_id' => $this->config['sender_id'],
48+
'project_id' => $this->senderId,
4049
];
4150
}
4251

0 commit comments

Comments
 (0)