Passed
Push — master ( e4bd8f...4069ad )
by Anton
02:47
created
src/Auth/Cycle/Token.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
         array $payload,
51 51
         \DateTimeImmutable $createdAt,
52 52
         \DateTimeInterface $expiresAt = null
53
-    ) {
53
+    ){
54 54
         $this->id = $id;
55 55
 
56 56
         $this->secretValue = $secretValue;
Please login to merge, or discard this patch.
src/Auth/Cycle/TokenStorage.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public function load(string $id): ?TokenInterface
40 40
     {
41
-        if (strpos($id, ':') === false) {
41
+        if (strpos($id, ':') === false){
42 42
             return null;
43 43
         }
44 44
 
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
         /** @var Token $token */
48 48
         $token = $this->orm->getRepository(Token::class)->findByPK($pk);
49 49
 
50
-        if ($token === null || !hash_equals($token->getHashedValue(), hash('sha512', $hash))) {
50
+        if ($token === null || !hash_equals($token->getHashedValue(), hash('sha512', $hash))){
51 51
             // hijacked or deleted
52 52
             return null;
53 53
         }
54 54
 
55 55
         $token->setSecretValue($hash);
56 56
 
57
-        if ($token->getExpiresAt() !== null && $token->getExpiresAt() < new \DateTime()) {
57
+        if ($token->getExpiresAt() !== null && $token->getExpiresAt() < new \DateTime()){
58 58
             $this->delete($token);
59 59
             return null;
60 60
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function create(array $payload, \DateTimeInterface $expiresAt = null): TokenInterface
69 69
     {
70
-        try {
70
+        try{
71 71
             $token = new Token(
72 72
                 $this->issueID(),
73 73
                 $this->randomHash(128),
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             (new Transaction($this->orm))->persist($token)->run();
80 80
 
81 81
             return $token;
82
-        } catch (\Throwable $e) {
82
+        }catch (\Throwable $e){
83 83
             throw new TokenStorageException('Unable to create token', $e->getCode(), $e);
84 84
         }
85 85
     }
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function delete(TokenInterface $token): void
91 91
     {
92
-        try {
92
+        try{
93 93
             (new Transaction($this->orm))->delete($token)->run();
94
-        } catch (\Throwable $e) {
94
+        }catch (\Throwable $e){
95 95
             throw new TokenStorageException('Unable to delete token', $e->getCode(), $e);
96 96
         }
97 97
     }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             $this->orm->getSource(Token::class)->getTable()
111 111
         );
112 112
 
113
-        while ((clone $query)->where('id', $id)->count('id') !== 0) {
113
+        while ((clone $query)->where('id', $id)->count('id') !== 0){
114 114
             $id = $this->randomHash(64);
115 115
         }
116 116
 
Please login to merge, or discard this patch.