Skip to content

Commit 3b57ecd

Browse files
committed
Add notes to constructor
1 parent a5e2bab commit 3b57ecd

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

api.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class LINEAPI
8787
* @link https://developers.line.biz/en/docs/messaging-api/getting-started/
8888
* @link https://developers.line.biz/en/docs/messaging-api/building-bot/#issue-a-channel-access-token
8989
*
90-
* @var string $channelAccessToken
90+
* @var string|null $channelAccessToken
9191
*/
9292
private $channelAccessToken;
9393

@@ -97,7 +97,7 @@ class LINEAPI
9797
* @link https://developers.line.biz/en/docs/messaging-api/getting-started/
9898
* @link https://developers.line.biz/en/docs/messaging-api/receiving-messages/
9999
*
100-
* @var string $channelSecret
100+
* @var string|null $channelSecret
101101
*/
102102
private $channelSecret;
103103

@@ -142,6 +142,16 @@ class LINEAPI
142142
*/
143143
const HTTP_METHOD_DELETE = 2;
144144

145+
/**
146+
* LINEAPI constructor.
147+
*
148+
* This is the constructor of API, to initialize your certificates into it.
149+
* If you need to use issueChannelAccessToken, you can set both of them as null,
150+
* issueChannelAccessToken will re-set up automatically.
151+
*
152+
* @param $channelAccessToken
153+
* @param $channelSecret
154+
*/
145155
public function __construct($channelAccessToken, $channelSecret)
146156
{
147157
$this->channelAccessToken = $channelAccessToken;
@@ -186,6 +196,7 @@ public function issueChannelAccessToken($channelId, $channelSecret)
186196
} else {
187197
$data = json_decode($response);
188198
$this->channelAccessToken = $data->access_token;
199+
$this->channelSecret = $channelSecret;
189200
return $data;
190201
}
191202
}

0 commit comments

Comments
 (0)