| @@ -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 | } | 
| @@ -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 | |
| @@ -56,8 +56,8 @@ discard block | ||
| 56 | 56 | $context = stream_context_create( | 
| 57 | 57 | [ | 
| 58 | 58 | 'ssl' => array( | 
| 59 | - 'verify_peer' => false, | |
| 60 | - 'verify_peer_name' => false | |
| 59 | + 'verify_peer' => false, | |
| 60 | + 'verify_peer_name' => false | |
| 61 | 61 | )] | 
| 62 | 62 | ); | 
| 63 | 63 | |
| @@ -130,8 +130,8 @@ discard block | ||
| 130 | 130 | $context = stream_context_create( | 
| 131 | 131 | [ | 
| 132 | 132 | 'ssl' => array( | 
| 133 | - 'verify_peer' => false, | |
| 134 | - 'verify_peer_name' => false | |
| 133 | + 'verify_peer' => false, | |
| 134 | + 'verify_peer_name' => false | |
| 135 | 135 | )] | 
| 136 | 136 | ); | 
| 137 | 137 | |
| @@ -38,7 +38,7 @@ discard block | ||
| 38 | 38 | public function __construct(Invoice $invoice, $settings) | 
| 39 | 39 |      { | 
| 40 | 40 | $this->invoice($invoice); | 
| 41 | - $this->settings = (object)$settings; | |
| 41 | + $this->settings = (object) $settings; | |
| 42 | 42 | } | 
| 43 | 43 | |
| 44 | 44 | /** | 
| @@ -79,7 +79,7 @@ discard block | ||
| 79 | 79 | |
| 80 | 80 | // purchase was not successful | 
| 81 | 81 |          if ($data[0] != "0") { | 
| 82 | - throw new PurchaseFailedException($this->translateStatus($data[0]), (int)$data[0]); | |
| 82 | + throw new PurchaseFailedException($this->translateStatus($data[0]), (int) $data[0]); | |
| 83 | 83 | } | 
| 84 | 84 | |
| 85 | 85 | $this->invoice->transactionId($data[1]); | 
| @@ -143,7 +143,7 @@ discard block | ||
| 143 | 143 | } | 
| 144 | 144 | |
| 145 | 145 | // step1: verify request | 
| 146 | - $verifyResponse = (int)$soap->bpVerifyRequest($data)->return; | |
| 146 | + $verifyResponse = (int) $soap->bpVerifyRequest($data)->return; | |
| 147 | 147 |          if ($verifyResponse != 0) { | 
| 148 | 148 | // rollback money and throw exception | 
| 149 | 149 | // avoid rollback if request was already verified | 
| @@ -16,10 +16,10 @@ | ||
| 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 | /** | 
| @@ -52,7 +52,7 @@ discard block | ||
| 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 | ||
| 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', | 
| @@ -132,7 +132,7 @@ discard block | ||
| 132 | 132 |          if ($response->getStatusCode() != 200) { | 
| 133 | 133 | $message = 'تراکنش تایید نشد'; | 
| 134 | 134 | |
| 135 | - throw new InvalidPaymentException($message, (int)$response->getStatusCode()); | |
| 135 | + throw new InvalidPaymentException($message, (int) $response->getStatusCode()); | |
| 136 | 136 | } | 
| 137 | 137 | |
| 138 | 138 |          return new Receipt('digipay', $body["trackingCode"]); | 
| @@ -155,8 +155,8 @@ discard block | ||
| 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("خطا در هنگام احراز هویت."); | 
| @@ -43,7 +43,7 @@ discard block | ||
| 43 | 43 | public function __construct(Invoice $invoice, $settings) | 
| 44 | 44 |      { | 
| 45 | 45 | $this->invoice($invoice); | 
| 46 | - $this->settings = (object)$settings; | |
| 46 | + $this->settings = (object) $settings; | |
| 47 | 47 | } | 
| 48 | 48 | |
| 49 | 49 | /** | 
| @@ -75,7 +75,7 @@ discard block | ||
| 75 | 75 | */ | 
| 76 | 76 | public function pay(): RedirectionForm | 
| 77 | 77 |      { | 
| 78 | - return $this->redirectWithForm($this->settings->apiPaymentUrl . $this->invoice->getTransactionId(), [], 'GET'); | |
| 78 | + return $this->redirectWithForm($this->settings->apiPaymentUrl.$this->invoice->getTransactionId(), [], 'GET'); | |
| 79 | 79 | } | 
| 80 | 80 | |
| 81 | 81 | /** | 
| @@ -120,7 +120,7 @@ | ||
| 120 | 120 | $transactionId = $this->invoice->getTransactionId(); | 
| 121 | 121 | $paymentUrl = $this->getPaymentUrl(); | 
| 122 | 122 | |
| 123 | - $payUrl = $paymentUrl . $transactionId; | |
| 123 | + $payUrl = $paymentUrl.$transactionId; | |
| 124 | 124 | |
| 125 | 125 | return $this->redirectWithForm($payUrl, [], 'GET'); | 
| 126 | 126 | } | 
| @@ -36,7 +36,7 @@ | ||
| 36 | 36 | public function __construct(Invoice $invoice, $settings) | 
| 37 | 37 |      { | 
| 38 | 38 | $this->invoice($invoice); | 
| 39 | - $this->settings = (object)$settings; | |
| 39 | + $this->settings = (object) $settings; | |
| 40 | 40 | } | 
| 41 | 41 | |
| 42 | 42 | /** |