PluginProbe
Media Cloud Sync / 1.4.2
Media Cloud Sync v1.4.2
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
← All changes | includes/sdk/s3/Aws/Credentials/Credentials.php +11 -4 1.2.13 → 1.4.2 View file →
@@ -13,8 +13,9 @@
13 13 private $secret;
14 14 private $token;
15 15 private $expires;
16 16 private $accountId;
17 + private $source;
17 18 /**
18 19 * Constructs a new BasicAWSCredentials object, with the specified AWS
19 20 * access key and AWS secret key
20 21 *
@@ -22,9 +23,9 @@
22 23 * @param string $secret AWS secret access key
23 24 * @param string $token Security token to use
24 25 * @param int $expires UNIX timestamp for when credentials expire
25 26 */
26 - public function __construct($key, $secret, $token = null, $expires = null, $accountId = null)
27 + public function __construct($key, $secret, $token = null, $expires = null, $accountId = null, $source = CredentialSources::STATIC)
27 28 {
28 29 $this->key = \trim((string) $key);
29 30 $this->secret = \trim((string) $secret);
30 31 $this->token = $token;
@@ -29,12 +30,13 @@
29 30 $this->secret = \trim((string) $secret);
30 31 $this->token = $token;
31 32 $this->expires = $expires;
32 33 $this->accountId = $accountId;
34 + $this->source = $source ?? CredentialSources::STATIC;
33 35 }
34 36 public static function __set_state(array $state)
35 37 {
36 - return new self($state['key'], $state['secret'], $state['token'], $state['expires'], $state['accountId']);
38 + return new self($state['key'], $state['secret'], $state['token'], $state['expires'], $state['accountId'], $state['source'] ?? null);
37 39 }
38 40 public function getAccessKeyId()
39 41 {
40 42 return $this->key;
@@ -58,11 +60,15 @@
58 60 public function getAccountId()
59 61 {
60 62 return $this->accountId;
61 63 }
64 + public function getSource()
65 + {
66 + return $this->source;
67 + }
62 68 public function toArray()
63 69 {
64 - return ['key' => $this->key, 'secret' => $this->secret, 'token' => $this->token, 'expires' => $this->expires, 'accountId' => $this->accountId];
70 + return ['key' => $this->key, 'secret' => $this->secret, 'token' => $this->token, 'expires' => $this->expires, 'accountId' => $this->accountId, 'source' => $this->source];
65 71 }
66 72 public function serialize()
67 73 {
68 74 return \json_encode($this->__serialize());
@@ -81,9 +87,10 @@
81 87 $this->key = $data['key'];
82 88 $this->secret = $data['secret'];
83 89 $this->token = $data['token'];
84 90 $this->expires = $data['expires'];
85 - $this->accountId = $data['accountId'];
91 + $this->accountId = $data['accountId'] ?? null;
92 + $this->source = $data['source'] ?? null;
86 93 }
87 94 /**
88 95 * Internal-only. Used when IMDS is unreachable
89 96 * or returns expires credentials.