Passed
Pull Request — master (#6)
by Dan
06:20 queued 03:11
created
src/Message/Crypto.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,19 +6,19 @@
 block discarded – undo
6 6
     public function encrypt($plainText, $key) {
7 7
         $method = "AES-256-GCM";
8 8
         $initVector = openssl_random_pseudo_bytes(16);
9
-        $openMode = openssl_encrypt( $plainText, $method, $key, OPENSSL_RAW_DATA, $initVector, $tag );
9
+        $openMode = openssl_encrypt($plainText, $method, $key, OPENSSL_RAW_DATA, $initVector, $tag);
10 10
 
11
-        return bin2hex( $initVector ).bin2hex( $openMode . $tag );
11
+        return bin2hex($initVector).bin2hex($openMode.$tag);
12 12
     }
13 13
 
14 14
     public function decrypt($encryptedText, $key) {
15 15
         $method = 'AES-256-GCM';
16
-        $encryptedText = hex2bin( $encryptedText );
16
+        $encryptedText = hex2bin($encryptedText);
17 17
         $iv_len = $tag_length = 16;
18
-        $iv = substr( $encryptedText, 0, $iv_len );
19
-        $tag = substr( $encryptedText, -$tag_length, $iv_len );
20
-        $ciphertext = substr( $encryptedText, $iv_len, -$tag_length );
18
+        $iv = substr($encryptedText, 0, $iv_len);
19
+        $tag = substr($encryptedText, -$tag_length, $iv_len);
20
+        $ciphertext = substr($encryptedText, $iv_len, -$tag_length);
21 21
 
22
-        return openssl_decrypt( $ciphertext, $method, $key, OPENSSL_RAW_DATA, $iv, $tag );
22
+        return openssl_decrypt($ciphertext, $method, $key, OPENSSL_RAW_DATA, $iv, $tag);
23 23
     }
24 24
 }
25 25
\ No newline at end of file
Please login to merge, or discard this patch.
src/Message/CompletePurchaseResponse.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
             throw new InvalidResponseException('Invalid response from payment gateway');
42 42
         }
43 43
 
44
-        if ( empty($decryptedString) ) {
44
+        if (empty($decryptedString)) {
45 45
             throw new InvalidResponseException('Invalid response from payment gateway');
46 46
         }
47 47
 
Please login to merge, or discard this patch.
src/Message/PurchaseRequest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
         $data['billing_email'] = $this->getBillingEmail();
225 225
         $data['billing_tel'] = $this->getBillingTel();
226 226
 
227
-        if ( $this->getCard() ) {
227
+        if ($this->getCard()) {
228 228
             $data['card_number'] = $this->getCard()->getNumber();
229 229
             $data['expiry_month'] = $this->getCard()->getExpiryMonth();
230 230
             $data['expiry_year'] = $this->getCard()->getExpiryYear();
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
     {
247 247
         $merchant_data = [];
248 248
 
249
-        foreach ( $this->getData() as $k => $v ) {
250
-            if ( !empty($v) ) {
249
+        foreach ($this->getData() as $k => $v) {
250
+            if (!empty($v)) {
251 251
                 $merchant_data[$k] = urlencode($v);
252 252
             }
253 253
         }
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 
260 260
         $encrypted_data = $cryto->encrypt(http_build_query($merchant_data), $this->getWorkingKey());
261 261
 
262
-        $url = $this->getEndpoint() . '&encRequest=' . $encrypted_data . '&access_code=' . $this->getAccessCode();
262
+        $url = $this->getEndpoint().'&encRequest='.$encrypted_data.'&access_code='.$this->getAccessCode();
263 263
 
264 264
         return $this->response = new PurchaseResponse($this, [
265 265
             'url'           => $url,
Please login to merge, or discard this patch.