Completed
Push — master ( 5ef263...edb1a0 )
by Neomerx
04:25
created
src/Repositories/TokenRepository.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     public function createCode(TokenInterface $code): TokenInterface
48 48
     {
49 49
         try {
50
-            $now    = $this->ignoreException(function (): DateTimeImmutable {
50
+            $now    = $this->ignoreException(function(): DateTimeImmutable {
51 51
                 return new DateTimeImmutable();
52 52
             });
53 53
             $schema = $this->getDatabaseSchema();
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
             $tokenIdentifier = null;
63 63
             if (empty($scopeIdentifiers = $code->getScopeIdentifiers()) === false) {
64
-                $this->inTransaction(function () use ($values, $scopeIdentifiers, &$tokenIdentifier) {
64
+                $this->inTransaction(function() use ($values, $scopeIdentifiers, &$tokenIdentifier) {
65 65
                     $this->createResource($values);
66 66
                     $tokenIdentifier = $this->getLastInsertId();
67 67
                     $this->bindScopeIdentifiers($tokenIdentifier, $scopeIdentifiers);
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
         try {
91 91
             $query = $this->getConnection()->createQueryBuilder();
92 92
 
93
-            $now   = $this->ignoreException(function (): DateTimeImmutable {
93
+            $now   = $this->ignoreException(function(): DateTimeImmutable {
94 94
                 return new DateTimeImmutable();
95 95
             });
96 96
             $dbNow = $this->createTypedParameter($query, $now);
97 97
 
98
-            $earliestExpired = $this->ignoreException(function () use ($now, $expirationInSeconds) : DateTimeImmutable {
98
+            $earliestExpired = $this->ignoreException(function() use ($now, $expirationInSeconds) : DateTimeImmutable {
99 99
                 /** @var DateTimeImmutable $now */
100 100
                 return $now->sub(new DateInterval("PT{$expirationInSeconds}S"));
101 101
             });
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
             $schema = $this->getDatabaseSchema();
104 104
             $query
105 105
                 ->update($this->getTableNameForWriting())
106
-                ->where($schema->getTokensCodeColumn() . '=' . $this->createTypedParameter($query, $token->getCode()))
106
+                ->where($schema->getTokensCodeColumn().'='.$this->createTypedParameter($query, $token->getCode()))
107 107
                 ->andWhere(
108
-                    $schema->getTokensCodeCreatedAtColumn() . '>' .
108
+                    $schema->getTokensCodeCreatedAtColumn().'>'.
109 109
                     $this->createTypedParameter($query, $earliestExpired)
110 110
                 )
111 111
                 ->set($schema->getTokensValueColumn(), $this->createTypedParameter($query, $token->getValue()))
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     public function createToken(TokenInterface $token): TokenInterface
139 139
     {
140 140
         try {
141
-            $now        = $this->ignoreException(function (): DateTimeImmutable {
141
+            $now        = $this->ignoreException(function(): DateTimeImmutable {
142 142
                 return new DateTimeImmutable();
143 143
             });
144 144
             $schema     = $this->getDatabaseSchema();
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 
166 166
             $tokenIdentifier = null;
167 167
             if (empty($scopeIdentifiers = $token->getScopeIdentifiers()) === false) {
168
-                $this->inTransaction(function () use ($values, $scopeIdentifiers, &$tokenIdentifier) {
168
+                $this->inTransaction(function() use ($values, $scopeIdentifiers, &$tokenIdentifier) {
169 169
                     $this->createResource($values);
170 170
                     $tokenIdentifier = $this->getLastInsertId();
171 171
                     $this->bindScopeIdentifiers($tokenIdentifier, $scopeIdentifiers);
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
      */
195 195
     public function bindScopes(int $identifier, iterable $scopes): void
196 196
     {
197
-        $getIdentifiers = function (iterable $scopes): iterable {
197
+        $getIdentifiers = function(iterable $scopes): iterable {
198 198
             foreach ($scopes as $scope) {
199 199
                 /** @var ScopeInterface $scope */
200 200
                 assert($scope instanceof ScopeInterface);
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         $schema = $this->getDatabaseSchema();
321 321
         /** @var TokenInterface[] $tokens */
322 322
         $tokens = $this->readEnabledTokensByColumnWithExpirationCheck(
323
-            (string)$userId,
323
+            (string) $userId,
324 324
             $schema->getTokensUserIdentityColumn(),
325 325
             $expirationInSeconds,
326 326
             $schema->getTokensValueCreatedAtColumn(),
@@ -363,13 +363,13 @@  discard block
 block discarded – undo
363 363
             $query = $this->getConnection()->createQueryBuilder();
364 364
 
365 365
             $schema = $this->getDatabaseSchema();
366
-            $now    = $this->ignoreException(function (): DateTimeImmutable {
366
+            $now    = $this->ignoreException(function(): DateTimeImmutable {
367 367
                 return new DateTimeImmutable();
368 368
             });
369 369
             $dbNow  = $this->createTypedParameter($query, $now);
370 370
             $query
371 371
                 ->update($this->getTableNameForWriting())
372
-                ->where($this->getPrimaryKeyName() . '=' . $this->createTypedParameter($query, $token->getIdentifier()))
372
+                ->where($this->getPrimaryKeyName().'='.$this->createTypedParameter($query, $token->getIdentifier()))
373 373
                 ->set($schema->getTokensValueColumn(), $this->createTypedParameter($query, $token->getValue()))
374 374
                 ->set($schema->getTokensValueCreatedAtColumn(), $dbNow);
375 375
             if ($token->getRefreshValue() !== null) {
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
         $schema = $this->getDatabaseSchema();
417 417
         $query
418 418
             ->update($this->getTableNameForWriting())
419
-            ->where($this->getPrimaryKeyName() . '=' . $this->createTypedParameter($query, $identifier))
419
+            ->where($this->getPrimaryKeyName().'='.$this->createTypedParameter($query, $identifier))
420 420
             ->set($schema->getTokensIsEnabledColumn(), $this->createTypedParameter($query, false));
421 421
 
422 422
         $numberOfUpdated = $query->execute();
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
         $query = $this->addExpirationCondition(
544 544
             $query->select($columns)
545 545
                 ->from($this->getTableNameForReading())
546
-                ->where($column . '=' . $this->createTypedParameter($query, $identifier))
546
+                ->where($column.'='.$this->createTypedParameter($query, $identifier))
547 547
                 // SQLite and MySQL work fine with just 1 but PostgreSQL wants it to be a string '1'
548 548
                 ->andWhere($query->expr()->eq($this->getDatabaseSchema()->getTokensIsEnabledColumn(), "'1'")),
549 549
             $expirationInSeconds,
@@ -565,11 +565,11 @@  discard block
 block discarded – undo
565 565
         int $expirationInSeconds,
566 566
         string $createdAtColumn
567 567
     ): QueryBuilder {
568
-        $earliestExpired = $this->ignoreException(function () use ($expirationInSeconds) : DateTimeImmutable {
568
+        $earliestExpired = $this->ignoreException(function() use ($expirationInSeconds) : DateTimeImmutable {
569 569
             return (new DateTimeImmutable())->sub(new DateInterval("PT{$expirationInSeconds}S"));
570 570
         });
571 571
 
572
-        $query->andWhere($createdAtColumn . '>' . $this->createTypedParameter($query, $earliestExpired));
572
+        $query->andWhere($createdAtColumn.'>'.$this->createTypedParameter($query, $earliestExpired));
573 573
 
574 574
         return $query;
575 575
     }
Please login to merge, or discard this patch.
src/Repositories/BaseRepository.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
         assert(is_numeric($lastInsertId));
183 183
 
184
-        return (int)$lastInsertId;
184
+        return (int) $lastInsertId;
185 185
     }
186 186
 
187 187
     /**
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
             $statement = $query
215 215
                 ->select($columns)
216 216
                 ->from($this->getTableNameForReading())
217
-                ->where($column . '=' . $this->createTypedParameter($query, $identifier))
217
+                ->where($column.'='.$this->createTypedParameter($query, $identifier))
218 218
                 ->execute();
219 219
 
220 220
             $statement->setFetchMode(PDO::FETCH_CLASS, $this->getClassName());
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
             $query
244 244
                 ->update($this->getTableNameForWriting())
245
-                ->where($this->getPrimaryKeyName() . '=' . $this->createTypedParameter($query, $identifier));
245
+                ->where($this->getPrimaryKeyName().'='.$this->createTypedParameter($query, $identifier));
246 246
             foreach ($values as $key => $value) {
247 247
                 $query->set($key, $this->createTypedParameter($query, $value));
248 248
             }
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 
272 272
             $query
273 273
                 ->delete($this->getTableNameForWriting())
274
-                ->where($this->getPrimaryKeyName() . '=' . $this->createTypedParameter($query, $identifier));
274
+                ->where($this->getPrimaryKeyName().'='.$this->createTypedParameter($query, $identifier));
275 275
 
276 276
             $numberOfDeleted = $query->execute();
277 277
             assert(is_int($numberOfDeleted) === true);
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
         assert(is_string($primaryKey) === true || is_int($primaryKey) === true);
305 305
 
306 306
         try {
307
-            $this->inTransaction(function () use (
307
+            $this->inTransaction(function() use (
308 308
                 $intTableName,
309 309
                 $intPrimaryKeyName,
310 310
                 $intForeignKeyName,
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
             $query
354 354
                 ->select($intForeignKeyName)
355 355
                 ->from($intTableName)
356
-                ->where($intPrimaryKeyName . '=' . $this->createTypedParameter($query, $identifier));
356
+                ->where($intPrimaryKeyName.'='.$this->createTypedParameter($query, $identifier));
357 357
 
358 358
             $statement = $query->execute();
359 359
             $statement->setFetchMode(PDO::FETCH_NUM);
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
             $query
388 388
                 ->delete($intTableName)
389
-                ->where($intPrimaryKeyName . '=' . $this->createTypedParameter($query, $identifier));
389
+                ->where($intPrimaryKeyName.'='.$this->createTypedParameter($query, $identifier));
390 390
 
391 391
             $numberOfDeleted = $query->execute();
392 392
             assert(is_int($numberOfDeleted) === true);
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
             $query
422 422
                 ->select($hasManyColumn)
423 423
                 ->from($hasManyTableName)
424
-                ->where($hasManyFkName . '=' . $this->createTypedParameter($query, $identifier));
424
+                ->where($hasManyFkName.'='.$this->createTypedParameter($query, $identifier));
425 425
 
426 426
             $statement = $query->execute();
427 427
             $statement->setFetchMode(PDO::FETCH_NUM);
Please login to merge, or discard this patch.
src/Adaptors/Generic/TokenRepository.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -154,8 +154,7 @@  discard block
 block discarded – undo
154 154
 
155 155
                     $curScopes[] = $scopeId;
156 156
                 }
157
-                $curTokenId === null || empty($curScopes) === true ?:
158
-                    $tokens[$curTokenId]->setScopeIdentifiers($curScopes);
157
+                $curTokenId === null || empty($curScopes) === true ?: $tokens[$curTokenId]->setScopeIdentifiers($curScopes);
159 158
             }
160 159
 
161 160
             return $tokens;
@@ -182,7 +181,7 @@  discard block
 block discarded – undo
182 181
                 $tokenId = $data[$schema->getTokensIdentityColumn()];
183 182
                 assert(is_numeric($tokenId));
184 183
 
185
-                $scopes                                     = $this->readScopeIdentifiers((int)$tokenId);
184
+                $scopes                                     = $this->readScopeIdentifiers((int) $tokenId);
186 185
                 $data[$schema->getTokensViewScopesColumn()] = $scopes;
187 186
                 $result                                     = $data;
188 187
             }
Please login to merge, or discard this patch.