@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $block_type = "\x01"; |
92 | 92 | $padding = str_repeat("\xFF", $pad_length); |
93 | 93 | } |
94 | - return "\x00" . $block_type . $padding . "\x00" . $data; |
|
94 | + return "\x00".$block_type.$padding."\x00".$data; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | public static function removePKCS1Padding($data, $blocksize) |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | while ($div > 0) { |
137 | 137 | $mod = bcmod($div, $base); |
138 | 138 | $div = bcdiv($div, $base); |
139 | - $result = chr($mod) . $result; |
|
139 | + $result = chr($mod).$result; |
|
140 | 140 | } |
141 | 141 | return str_pad($result, $blocksize, "\x00", STR_PAD_LEFT); |
142 | 142 | } |
@@ -193,7 +193,7 @@ |
||
193 | 193 | $terminalCode = $this->settings->terminalCode; |
194 | 194 | $amount = $this->invoice->getAmount(); //rial |
195 | 195 | $redirectAddress = $this->settings->callbackUrl; |
196 | - $invoiceNumber = crc32($this->invoice->getUuid()) . rand(0, time()); |
|
196 | + $invoiceNumber = crc32($this->invoice->getUuid()).rand(0, time()); |
|
197 | 197 | $timeStamp = date("Y/m/d H:i:s"); |
198 | 198 | $invoiceDate = date("Y/m/d H:i:s"); |
199 | 199 |
@@ -70,7 +70,7 @@ |
||
70 | 70 | return; |
71 | 71 | } |
72 | 72 | |
73 | - array_walk($listeners[$event], function ($listener) use ($arguments) { |
|
73 | + array_walk($listeners[$event], function($listener) use ($arguments) { |
|
74 | 74 | call_user_func_array($listener, $arguments); |
75 | 75 | }); |
76 | 76 | } |
@@ -104,7 +104,7 @@ |
||
104 | 104 | */ |
105 | 105 | protected function getDefaultViewRenderer() : callable |
106 | 106 | { |
107 | - return function (string $view, string $action, array $inputs, string $method) { |
|
107 | + return function(string $view, string $action, array $inputs, string $method) { |
|
108 | 108 | ob_start(); |
109 | 109 | |
110 | 110 | require($view); |
@@ -93,7 +93,7 @@ |
||
93 | 93 | { |
94 | 94 | $strategy = static::$strategies[$this->getMode()] ?? null; |
95 | 95 | |
96 | - if (! $strategy) { |
|
96 | + if (!$strategy) { |
|
97 | 97 | $this->strategyNotFound(); |
98 | 98 | } |
99 | 99 |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | if (empty($body['code']) || $body['code'] != -1) { |
83 | 83 | // error has happened |
84 | - throw new PurchaseFailedException($body['message'], $body['code']??0); |
|
84 | + throw new PurchaseFailedException($body['message'], $body['code'] ?? 0); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | $this->invoice->transactionId($body['trans_id']); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | if (!isset($body['code']) || $body['code'] != 0) { |
138 | 138 | $message = $body['message'] ?? 'خطای ناشناخته ای رخت داده است'; |
139 | 139 | |
140 | - throw new InvalidPaymentException($message, $body['code']??0); |
|
140 | + throw new InvalidPaymentException($message, $body['code'] ?? 0); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | return $this->createReceipt($transactionId); |
@@ -126,7 +126,7 @@ |
||
126 | 126 | |
127 | 127 | if ($result->Status != 100) { |
128 | 128 | $message = $this->translateStatus($result->Status); |
129 | - throw new InvalidPaymentException($message, is_numeric($result->Status)?$result->Status:0); |
|
129 | + throw new InvalidPaymentException($message, is_numeric($result->Status) ? $result->Status : 0); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | return $this->createReceipt($result->RefID); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | if (empty($body['status']) || $body['status'] != 1) { |
81 | 81 | // some error has happened |
82 | - throw new PurchaseFailedException($body['status'], is_numeric($body['status']??0)?($body['status']??0):0); |
|
82 | + throw new PurchaseFailedException($body['status'], is_numeric($body['status'] ?? 0) ? ($body['status'] ?? 0) : 0); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | $this->invoice->transactionId($body['invoice_key']); |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | private function notVerified($message, $status = 0) |
157 | 157 | { |
158 | 158 | if (empty($message)) { |
159 | - throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', is_numeric($status)?$status:0); |
|
159 | + throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', is_numeric($status) ? $status : 0); |
|
160 | 160 | } else { |
161 | - throw new InvalidPaymentException($message, is_numeric($status)?$status:0); |
|
161 | + throw new InvalidPaymentException($message, is_numeric($status) ? $status : 0); |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | } |
@@ -233,9 +233,9 @@ |
||
233 | 233 | "54" => "مدت زمان تایید پرداخت سپری شده است.", |
234 | 234 | ); |
235 | 235 | if (array_key_exists($status, $translations)) { |
236 | - throw new InvalidPaymentException($translations[$status], is_numeric($status)?$status:0); |
|
236 | + throw new InvalidPaymentException($translations[$status], is_numeric($status) ? $status : 0); |
|
237 | 237 | } else { |
238 | - throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', is_numeric($status)?$status:0); |
|
238 | + throw new InvalidPaymentException('خطای ناشناخته ای رخ داده است.', is_numeric($status) ? $status : 0); |
|
239 | 239 | } |
240 | 240 | } |
241 | 241 | } |