Skip to content

Commit 0def13d

Browse files
docs: added inline docs for ClientCredentialProvider.php
1 parent 96f5ca2 commit 0def13d

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

Diff for: src/Twilio/CredentialProvider/ClientCredentialProvider.php

+28-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,19 @@
77
use Twilio\Http\BearerToken\ApiTokenManager;
88
use Twilio\Http\BearerToken\TokenManager;
99

10-
10+
/**
11+
* Class ClientCredentialProvider
12+
* Credential provider for OAuth in public apis
13+
*/
1114
class ClientCredentialProvider extends CredentialProvider {
15+
/**
16+
* @var array $options - array of params required for token api
17+
*/
1218
private $options;
19+
20+
/**
21+
* @var TokenManager $tokenManager - handles fetching and refreshing of token
22+
*/
1323
private $tokenManager;
1424

1525
public function __construct() {
@@ -40,7 +50,12 @@ public function setTokenManager(TokenManager $tokenManager): void {
4050
$this->tokenManager = $tokenManager;
4151
}
4252

43-
53+
/**
54+
* Magic method to get properties - returns the property if it exists in the options array
55+
* @param string $name
56+
* @return mixed value of the property
57+
* @throws TwilioException
58+
*/
4459
public function __get(string $name)
4560
{
4661
if (array_key_exists($name, $this->options)) {
@@ -49,6 +64,13 @@ public function __get(string $name)
4964
throw new TwilioException('Unknown property ' . $name);
5065
}
5166

67+
/**
68+
* Magic method to set properties - sets the value of the property if it exists in the options array
69+
* @param string $name
70+
* @param $value
71+
* @return void
72+
* @throws TwilioException
73+
*/
5274
public function __set(string $name, $value)
5375
{
5476
if (array_key_exists($name, $this->options)) {
@@ -58,6 +80,10 @@ public function __set(string $name, $value)
5880
}
5981
}
6082

83+
/**
84+
* Returns TokenAuthStrategy using ApiTokenManager
85+
* @return AuthStrategy
86+
*/
6187
public function toAuthStrategy(): AuthStrategy {
6288
if ($this->tokenManager === null) {
6389
$this->tokenManager = new ApiTokenManager($this->options);

0 commit comments

Comments
 (0)