Passed
Push — master ( 8f363b...db78bc )
by Smoren
11:21 queued 09:43
created
src/Helpers/AsymmetricLargeDataEncryptionHelper.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         $internalKeyEncrypted = AsymmetricEncryptionHelper::encryptByPublicKey($internalKey, $publicKey);
37 37
         try {
38 38
             $dataEncrypted = SymmetricEncryptionHelper::encrypt($data, $internalKey);
39
-        } catch(SymmetricEncryptionException $e) {
39
+        } catch (SymmetricEncryptionException $e) {
40 40
             throw new AsymmetricEncryptionException(
41 41
                 'cannot encrypt',
42 42
                 AsymmetricEncryptionException::CANNOT_ENCRYPT,
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         $internalKeyEncrypted = AsymmetricEncryptionHelper::encryptByPrivateKey($internalKey, $privateKey);
62 62
         try {
63 63
             $dataEncrypted = SymmetricEncryptionHelper::encrypt($data, $internalKey);
64
-        } catch(SymmetricEncryptionException $e) {
64
+        } catch (SymmetricEncryptionException $e) {
65 65
             throw new AsymmetricEncryptionException(
66 66
                 'cannot encrypt',
67 67
                 AsymmetricEncryptionException::CANNOT_ENCRYPT,
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
         try {
92 92
             return SymmetricEncryptionHelper::decrypt($dataPartEncrypted, $internalKeyDecrypted);
93
-        } catch(SymmetricEncryptionException $e) {
93
+        } catch (SymmetricEncryptionException $e) {
94 94
             throw new AsymmetricEncryptionException(
95 95
                 'cannot decrypt',
96 96
                 AsymmetricEncryptionException::CANNOT_DECRYPT,
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
         try {
119 119
             return SymmetricEncryptionHelper::decrypt($dataPartEncrypted, $internalKeyDecrypted);
120
-        } catch(SymmetricEncryptionException $e) {
120
+        } catch (SymmetricEncryptionException $e) {
121 121
             throw new AsymmetricEncryptionException(
122 122
                 'cannot decrypt',
123 123
                 AsymmetricEncryptionException::CANNOT_DECRYPT,
@@ -135,12 +135,12 @@  discard block
 block discarded – undo
135 135
     protected static function getPrefixMatches(string $dataEncrypted): array
136 136
     {
137 137
         preg_match('/^([0-9]+)_/', $dataEncrypted, $matches);
138
-        if(!isset($matches[1])) {
138
+        if (!isset($matches[1])) {
139 139
             throw new AsymmetricEncryptionException('cannot decrypt', AsymmetricEncryptionException::CANNOT_DECRYPT);
140 140
         }
141 141
         $matches[0] = strlen($matches[0]);
142 142
 
143
-        return [$matches[0], (int)$matches[1]];
143
+        return [$matches[0], (int) $matches[1]];
144 144
     }
145 145
 
146 146
     /**
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
         $charactersLength = strlen($characters);
155 155
         $randomString = '';
156 156
 
157
-        for($i = 0; $i < $length; $i++) {
158
-            $randomString .= $characters[rand(0, $charactersLength - 1)];
157
+        for ($i = 0; $i < $length; $i++) {
158
+            $randomString .= $characters[rand(0, $charactersLength-1)];
159 159
         }
160 160
 
161 161
         return $randomString;
Please login to merge, or discard this patch.