Passed
Pull Request — master (#85)
by
unknown
07:19
created
src/Drivers/Digipay/Digipay.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@
 block discarded – undo
16 16
 class Digipay extends Driver
17 17
 {
18 18
     /**
19
-    * Digipay Client.
20
-    *
21
-    * @var object
22
-    */
19
+     * Digipay Client.
20
+     *
21
+     * @var object
22
+     */
23 23
     protected $client;
24 24
 
25 25
     /**
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     public function __construct(Invoice $invoice, $settings)
53 53
     {
54 54
         $this->invoice($invoice);
55
-        $this->settings=$settings;
55
+        $this->settings = $settings;
56 56
         $this->client = new Client();
57 57
         $this->oauthToken = $this->oauth();
58 58
     }
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
     public function verify(): ReceiptInterface
115 115
     {
116
-        $tracingId=Request::input("trackingCode");
116
+        $tracingId = Request::input("trackingCode");
117 117
 
118 118
         $response = $this->client->request(
119 119
             'POST',
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
                     "grant_type" => 'password',
156 156
                 ]
157 157
             );
158
-        if ($response->getStatusCode()!=200) {
159
-            if ($response->getStatusCode()==401) {
158
+        if ($response->getStatusCode() != 200) {
159
+            if ($response->getStatusCode() == 401) {
160 160
                 throw new PurchaseFailedException("خطا نام کاربری یا رمز عبور شما اشتباه می باشد.");
161 161
             } else {
162 162
                 throw new PurchaseFailedException("خطا در هنگام احراز هویت.");
Please login to merge, or discard this patch.
src/Drivers/Zarinpal/Strategies/Normal.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         $result = json_decode($response->getBody()->getContents(), true);
102 102
 
103 103
         // some error has happened
104
-        if (! empty($result['errors']) || empty($result['data']) || $result['data']['code'] != 100) {
104
+        if (!empty($result['errors']) || empty($result['data']) || $result['data']['code'] != 100) {
105 105
             throw new PurchaseFailedException($result['errors']['message'], $result['errors']['code']);
106 106
         }
107 107
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
         $result = json_decode($response->getBody()->getContents(), true);
163 163
 
164
-        if (empty($result['data']) || ! isset($result['data']['ref_id']) || $result['data']['code'] != 100) {
164
+        if (empty($result['data']) || !isset($result['data']['ref_id']) || $result['data']['code'] != 100) {
165 165
             $message = $result['errors']['message'] ?? "";
166 166
             $code = $result['errors']['code'];
167 167
 
Please login to merge, or discard this patch.
src/Drivers/Jibit/JibitCache.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         if (true === $this->_checkCacheDir()) {
107 107
             $filename = $this->getCache();
108 108
             $filename = preg_replace('/[^0-9a-z\.\_\-]/i', '', strtolower($filename));
109
-            return $this->getCachePath() . $this->_getHash($filename) . $this->getExtension();
109
+            return $this->getCachePath().$this->_getHash($filename).$this->getExtension();
110 110
         }
111 111
     }
112 112
 
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
     private function _checkCacheDir()
119 119
     {
120 120
         if (!is_dir($this->getCachePath()) && !mkdir($this->getCachePath(), 0775, true)) {
121
-            throw new \Exception('Unable to create cache directory ' . $this->getCachePath());
121
+            throw new \Exception('Unable to create cache directory '.$this->getCachePath());
122 122
         } elseif (!is_readable($this->getCachePath()) || !is_writable($this->getCachePath())) {
123 123
             if (!chmod($this->getCachePath(), 0775)) {
124
-                throw new \Exception($this->getCachePath() . ' must be readable and writeable');
124
+                throw new \Exception($this->getCachePath().' must be readable and writeable');
125 125
             }
126 126
         }
127 127
         return true;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -228,7 +228,9 @@
 block discarded – undo
228 228
     {
229 229
         $cachedData = $this->_loadCache();
230 230
         (false === $timestamp) ? $type = 'data' : $type = 'time';
231
-        if (!isset($cachedData[$key][$type])) return null;
231
+        if (!isset($cachedData[$key][$type])) {
232
+            return null;
233
+        }
232 234
         return unserialize($cachedData[$key][$type]);
233 235
     }
234 236
 
Please login to merge, or discard this patch.
src/Drivers/Jibit/Jibit.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
     // Verify the payment (we must verify to ensure that user has paid the invoice).
73 73
     public function verify(): ReceiptInterface {
74 74
 
75
-       // $verifyUrl = $this->settings->verifyApiUrl;
75
+        // $verifyUrl = $this->settings->verifyApiUrl;
76 76
 
77 77
         $refNum = $this->invoice->getTransactionId();
78 78
         // Making payment verify
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         $this->invoice($invoice); // Set the invoice.
27 27
         $this->settings = (object) $settings; // Set settings.
28 28
         /** @var JibitBase $jibit */
29
-        $this->jibit = new JibitBase($this->settings->merchantId, $this->settings->apiSecret,$this->settings->apiPaymentUrl);
29
+        $this->jibit = new JibitBase($this->settings->merchantId, $this->settings->apiSecret, $this->settings->apiPaymentUrl);
30 30
 
31 31
     }
32 32
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         // Making payment request
38 38
         // you should save the order details in DB, you need if for verify
39
-        $requestResult = $this->jibit->paymentRequest($this->invoice->getAmount(), $this->invoice->getDetail('order_id'), $this->invoice->getDetail('mobile'),$this->settings->callbackUrl);
39
+        $requestResult = $this->jibit->paymentRequest($this->invoice->getAmount(), $this->invoice->getDetail('order_id'), $this->invoice->getDetail('mobile'), $this->settings->callbackUrl);
40 40
 
41 41
 
42 42
         if (!empty($requestResult['pspSwitchingUrl'])) {
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
         }
47 47
         if (!empty($requestResult['errors'])) {
48 48
             //fail result and show the error
49
-            $errMsgs = array_map(function ($err){ return $err['message']; }, $requestResult['errors']);
50
-            throw new PurchaseFailedException(implode('\n',$errMsgs));
49
+            $errMsgs = array_map(function($err) { return $err['message']; }, $requestResult['errors']);
50
+            throw new PurchaseFailedException(implode('\n', $errMsgs));
51 51
         }
52 52
 
53 53
         $transId = $requestResult['orderIdentifier'];
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 
84 84
             //show session detail
85 85
             $order = $this->jibit->getOrderById($refNum);
86
-            if (!empty($order['payerCard'])){
86
+            if (!empty($order['payerCard'])) {
87 87
                 //echo 'payer card pan mask: ' .$order['payerCard'];
88 88
             }
89 89
             //return new Receipt('jibit', 'payment_receipt_number');
Please login to merge, or discard this patch.
src/Drivers/Jibit/JibitBase.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
     private $cache;
13 13
     public $base_url;
14 14
     
15
-    public function __construct($apiKey, $secretKey,$base_url)
15
+    public function __construct($apiKey, $secretKey, $base_url)
16 16
     {
17 17
         $this->base_url = $base_url;
18 18
         $this->apiKey = $apiKey;
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function getOrderById($id)
57 57
     {
58
-        return  $this->callCurl('/orders/' .$id, [], true, 0,'GET');
58
+        return  $this->callCurl('/orders/'.$id, [], true, 0, 'GET');
59 59
 
60 60
     }
61 61
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             return $this->generateNewToken();
80 80
         }
81 81
 
82
-        throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException( 'unExcepted Err in generateToken.');
82
+        throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException('unExcepted Err in generateToken.');
83 83
 
84 84
     }
85 85
 
@@ -92,16 +92,16 @@  discard block
 block discarded – undo
92 92
         ];
93 93
         $result = $this->callCurl('/tokens/refresh', $data, false);
94 94
         if (empty($result['accessToken'])) {
95
-            throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException( 'Err in refresh token.');
95
+            throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException('Err in refresh token.');
96 96
         }
97 97
         if (!empty($result['accessToken'])) {
98
-            $this->cache->store('accessToken', 'Bearer ' . $result['accessToken'], 24 * 60 * 60 - 60);
98
+            $this->cache->store('accessToken', 'Bearer '.$result['accessToken'], 24 * 60 * 60 - 60);
99 99
             $this->cache->store('refreshToken', $result['refreshToken'], 48 * 60 * 60 - 60);
100
-            $this->setAccessToken('Bearer ' . $result['accessToken']);
100
+            $this->setAccessToken('Bearer '.$result['accessToken']);
101 101
             $this->setRefreshToken($result['refreshToken']);
102 102
             return 'ok';
103 103
         }
104
-        throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException( 'unExcepted Err in refreshToken.');
104
+        throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException('unExcepted Err in refreshToken.');
105 105
 
106 106
     }
107 107
 
@@ -122,15 +122,15 @@  discard block
 block discarded – undo
122 122
         if ($haveAuth) {
123 123
             $accessToken = $this->getAccessToken();
124 124
         }
125
-        $ch = curl_init($this->base_url . $url);
125
+        $ch = curl_init($this->base_url.$url);
126 126
         curl_setopt($ch, CURLOPT_USERAGENT, 'Jibit.class Rest Api');
127 127
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
128 128
         curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
129 129
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
130 130
         curl_setopt($ch, CURLOPT_HTTPHEADER, array(
131 131
             'Content-Type: application/json',
132
-            'Authorization: ' . $accessToken,
133
-            'Content-Length: ' . strlen($jsonData)
132
+            'Authorization: '.$accessToken,
133
+            'Content-Length: '.strlen($jsonData)
134 134
         ));
135 135
         $result = curl_exec($ch);
136 136
         $err = curl_error($ch);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         curl_close($ch);
139 139
 
140 140
         if ($err) {
141
-            throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException('cURL Error #:' . $err);
141
+            throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException('cURL Error #:'.$err);
142 142
         }
143 143
         if (empty($result['errors'])) {
144 144
             return $result;
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
             throw new \Shetabit\Multipay\Exceptions\PurchaseFailedException('Err in generate new token.');
192 192
         }
193 193
         if (!empty($result['accessToken'])) {
194
-            $this->cache->store('accessToken', 'Bearer ' . $result['accessToken'], 24 * 60 * 60 - 60);
194
+            $this->cache->store('accessToken', 'Bearer '.$result['accessToken'], 24 * 60 * 60 - 60);
195 195
             $this->cache->store('refreshToken', $result['refreshToken'], 48 * 60 * 60 - 60);
196
-            $this->setAccessToken('Bearer ' . $result['accessToken']);
196
+            $this->setAccessToken('Bearer '.$result['accessToken']);
197 197
             $this->setRefreshToken($result['refreshToken']);
198 198
             return 'ok';
199 199
         }
@@ -211,6 +211,6 @@  discard block
 block discarded – undo
211 211
         $this->generateToken();
212 212
         $data = [
213 213
         ];
214
-        return $this->callCurl('/orders/' . $refNum . '/verify', $data, true, 0, 'GET');
214
+        return $this->callCurl('/orders/'.$refNum.'/verify', $data, true, 0, 'GET');
215 215
     }
216 216
 }
Please login to merge, or discard this patch.