@@ -36,8 +36,6 @@ class DynamoDbStore implements PersistingStoreInterface
3636 use ExpiringStoreTrait;
3737
3838 private const DEFAULT_OPTIONS = [
39- 'access_key ' => null ,
40- 'secret_key ' => null ,
4139 'session_token ' => null ,
4240 'endpoint ' => null ,
4341 'region ' => null ,
@@ -60,7 +58,7 @@ class DynamoDbStore implements PersistingStoreInterface
6058 private int $ writeCapacityUnits ;
6159
6260 public function __construct (
63- DynamoDbClient |string $ clientOrDsn ,
61+ #[\SensitiveParameter] DynamoDbClient |string $ clientOrDsn ,
6462 array $ options = [],
6563 private readonly int $ initialTtl = 300 ,
6664 ) {
@@ -96,8 +94,8 @@ public function __construct(
9694
9795 $ clientConfiguration = [
9896 'region ' => $ options ['region ' ],
99- 'accessKeyId ' => rawurldecode ($ params ['user ' ] ?? '' ) ?: $ options [ ' access_key ' ] ?? self :: DEFAULT_OPTIONS [ ' access_key ' ] ,
100- 'accessKeySecret ' => rawurldecode ($ params ['pass ' ] ?? '' ) ?: $ options [ ' secret_key ' ] ?? self :: DEFAULT_OPTIONS [ ' secret_key ' ] ,
97+ 'accessKeyId ' => rawurldecode ($ params ['user ' ] ?? '' ) ?: null ,
98+ 'accessKeySecret ' => rawurldecode ($ params ['pass ' ] ?? '' ) ?: null ,
10199 ];
102100 if (null !== $ options ['session_token ' ]) {
103101 $ clientConfiguration ['sessionToken ' ] = $ options ['session_token ' ];
@@ -141,15 +139,15 @@ public function save(Key $key): void
141139 'Item ' => [
142140 $ this ->idAttr => new AttributeValue (['S ' => $ this ->getHashedKey ($ key )]),
143141 $ this ->tokenAttr => new AttributeValue (['S ' => $ this ->getUniqueToken ($ key )]),
144- $ this ->expirationAttr => new AttributeValue (['N ' => (string ) (\ microtime (true ) + $ this ->initialTtl )]),
142+ $ this ->expirationAttr => new AttributeValue (['N ' => (string ) (microtime (true ) + $ this ->initialTtl )]),
145143 ],
146144 'ConditionExpression ' => 'attribute_not_exists(#key) OR #expires_at < :now ' ,
147145 'ExpressionAttributeNames ' => [
148146 '#key ' => $ this ->idAttr ,
149147 '#expires_at ' => $ this ->expirationAttr ,
150148 ],
151149 'ExpressionAttributeValues ' => [
152- ':now ' => new AttributeValue (['N ' => (string ) \ microtime (true )]),
150+ ':now ' => new AttributeValue (['N ' => (string ) microtime (true )]),
153151 ],
154152 ]);
155153
@@ -196,7 +194,7 @@ public function exists(Key $key): bool
196194 $ item = $ existingLock ->getItem ();
197195
198196 // Item not found at all
199- if ($ item === [] ) {
197+ if (! $ item ) {
200198 return false ;
201199 }
202200
@@ -206,7 +204,7 @@ public function exists(Key $key): bool
206204 }
207205
208206 // If item is expired, consider it doesn't exist
209- return isset ($ item [$ this ->expirationAttr ]) && ((float ) $ item [$ this ->expirationAttr ]->getN ()) > \ microtime (true );
207+ return isset ($ item [$ this ->expirationAttr ]) && ((float ) $ item [$ this ->expirationAttr ]->getN ()) > microtime (true );
210208 }
211209
212210 public function putOffExpiration (Key $ key , float $ ttl ): void
@@ -225,7 +223,7 @@ public function putOffExpiration(Key $key, float $ttl): void
225223 'Item ' => [
226224 $ this ->idAttr => new AttributeValue (['S ' => $ this ->getHashedKey ($ key )]),
227225 $ this ->tokenAttr => new AttributeValue (['S ' => $ uniqueToken ]),
228- $ this ->expirationAttr => new AttributeValue (['N ' => (string ) (\ microtime (true ) + $ ttl )]),
226+ $ this ->expirationAttr => new AttributeValue (['N ' => (string ) (microtime (true ) + $ ttl )]),
229227 ],
230228 'ConditionExpression ' => 'attribute_exists(#key) AND (#token = :token OR #expires_at <= :now) ' ,
231229 'ExpressionAttributeNames ' => [
@@ -234,7 +232,7 @@ public function putOffExpiration(Key $key, float $ttl): void
234232 '#token ' => $ this ->tokenAttr ,
235233 ],
236234 'ExpressionAttributeValues ' => [
237- ':now ' => new AttributeValue (['N ' => (string ) \ microtime (true )]),
235+ ':now ' => new AttributeValue (['N ' => (string ) microtime (true )]),
238236 ':token ' => new AttributeValue (['S ' => $ uniqueToken ]),
239237 ],
240238 ]));
@@ -248,7 +246,7 @@ public function putOffExpiration(Key $key, float $ttl): void
248246 $ this ->checkNotExpired ($ key );
249247 }
250248
251- public function createTable (): void
249+ private function createTable (): void
252250 {
253251 $ this ->client ->createTable (new CreateTableInput ([
254252 'TableName ' => $ this ->tableName ,
0 commit comments