@@ -43,8 +43,7 @@ |
||
43 | 43 | private static function getUrl (string $endpoint, bool $pay = false): string { |
44 | 44 | if ($pay) { |
45 | 45 | $url = self::$sandbox ? self::SANDBOX_PAY_BASE : self::PAY_BASE; |
46 | - } |
|
47 | - else { |
|
46 | + } else { |
|
48 | 47 | $url = self::$sandbox ? self::SANDBOX_API_BASE : self::API_BASE; |
49 | 48 | } |
50 | 49 | $url .= $endpoint; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | private static CurlHandle $session; |
26 | 26 | |
27 | - public static function init (string $merchant_id = '', bool $sandbox = false, bool $zarin_gate = false): void { |
|
27 | + public static function init(string $merchant_id = '', bool $sandbox = false, bool $zarin_gate = false): void { |
|
28 | 28 | self::$sandbox = $sandbox; |
29 | 29 | self::$zarin_gate = $zarin_gate; |
30 | 30 | self::$merchant_id = $merchant_id; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | curl_setopt(self::$session, CURLOPT_POST, true); |
40 | 40 | } |
41 | 41 | |
42 | - private static function getUrl (string $endpoint, bool $pay = false): string { |
|
42 | + private static function getUrl(string $endpoint, bool $pay = false): string { |
|
43 | 43 | if ($pay) { |
44 | 44 | $url = self::$sandbox ? self::SANDBOX_PAY_BASE : self::PAY_BASE; |
45 | 45 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | return $url; |
54 | 54 | } |
55 | 55 | |
56 | - private static function execute (string $endpoint, array $params = []): object { |
|
56 | + private static function execute(string $endpoint, array $params = []): object { |
|
57 | 57 | foreach ($params as $key => $value) { |
58 | 58 | if (empty($value)) { |
59 | 59 | unset($params[$key]); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | /** |
88 | 88 | * @return object|requestInterface |
89 | 89 | */ |
90 | - public static function request (int $amount, string $description, string $callback_url, array $metadata = [], string $mobile = '', string $email = '', array $wages = [], int $card_pan = null, string $currency = ''): object { |
|
90 | + public static function request(int $amount, string $description, string $callback_url, array $metadata = [], string $mobile = '', string $email = '', array $wages = [], int $card_pan = null, string $currency = ''): object { |
|
91 | 91 | return self::execute('/request.json', [ |
92 | 92 | 'amount' => $amount, |
93 | 93 | 'description' => $description, |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | ]); |
102 | 102 | } |
103 | 103 | |
104 | - public static function payURL (string|array $authority): bool|string { |
|
104 | + public static function payURL(string | array $authority): bool | string { |
|
105 | 105 | if (is_array($authority)) { |
106 | 106 | if (!isset($authority->authority)) { |
107 | 107 | return false; |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | /** |
115 | 115 | * @return object|verifyInterface |
116 | 116 | */ |
117 | - public static function verify (int $amount, string $authority): object { |
|
117 | + public static function verify(int $amount, string $authority): object { |
|
118 | 118 | return self::execute('/verify.json', [ |
119 | 119 | 'amount' => $amount, |
120 | 120 | 'authority' => $authority |
@@ -124,14 +124,14 @@ discard block |
||
124 | 124 | /** |
125 | 125 | * @return object|unverifiedInterface |
126 | 126 | */ |
127 | - public static function unVerified (): object { |
|
127 | + public static function unVerified(): object { |
|
128 | 128 | return self::execute('/unVerified.json'); |
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
132 | 132 | * @return object|refundInterface |
133 | 133 | */ |
134 | - public static function refund (string $authorization, string $authority): object { |
|
134 | + public static function refund(string $authorization, string $authority): object { |
|
135 | 135 | return self::execute('/refund.json', [ |
136 | 136 | 'authorization' => $authorization, |
137 | 137 | 'authority' => $authority |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | #[NoReturn] |
142 | - public static function redirect (string $url): void { |
|
143 | - @header('Location: ' . $url); |
|
142 | + public static function redirect(string $url): void { |
|
143 | + @header('Location: '.$url); |
|
144 | 144 | die("<meta http-equiv='refresh' content='0; url=$url' /><script>window.location.href = '$url';</script>"); |
145 | 145 | } |
146 | 146 | |
147 | - public static function processCallback (int $amount): object|bool|int { |
|
147 | + public static function processCallback(int $amount): object | bool | int { |
|
148 | 148 | if (!isset($_GET['Authority']) || !isset($_GET['Status'])) { |
149 | 149 | return false; |
150 | 150 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the |
57 | 57 | * thumbnail was uploaded using multipart/form-data under <file_attach_name>. |
58 | 58 | */ |
59 | - public CURLFile|string $thumbnail; |
|
59 | + public CURLFile | string $thumbnail; |
|
60 | 60 | |
61 | 61 | /** `video` and `animation` only. width */ |
62 | 62 | public int $width; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public bool $disable_content_type_detection; |
84 | 84 | |
85 | 85 | |
86 | - public function __construct(stdClass|null $object = null) { |
|
86 | + public function __construct(stdClass | null $object = null) { |
|
87 | 87 | if ($object != null) { |
88 | 88 | parent::__construct($object, self::subs); |
89 | 89 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | public string $short_description; |
16 | 16 | |
17 | 17 | |
18 | - public function __construct(stdClass|null $object = null) { |
|
18 | + public function __construct(stdClass | null $object = null) { |
|
19 | 19 | if ($object != null) { |
20 | 20 | parent::__construct($object, self::subs); |
21 | 21 | } |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | public string $sticker_type; |
22 | 22 | |
23 | 23 | /** True, if the sticker set contains animated stickers */ |
24 | - public null|bool $is_animated = null; |
|
24 | + public null | bool $is_animated = null; |
|
25 | 25 | |
26 | 26 | /** True, if the sticker set contains video stickers */ |
27 | - public null|bool $is_video = null; |
|
27 | + public null | bool $is_video = null; |
|
28 | 28 | |
29 | 29 | /** Deprecated use sticker_type instead, True, if the sticker set contains masks */ |
30 | - public null|bool $contains_masks = null; |
|
30 | + public null | bool $contains_masks = null; |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * List of all set stickers |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | public array $stickers; |
37 | 37 | |
38 | 38 | /** Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format */ |
39 | - public null|photoSize $thumbnail = null; |
|
39 | + public null | photoSize $thumbnail = null; |
|
40 | 40 | |
41 | 41 | |
42 | - public function __construct(stdClass|null $object = null) { |
|
42 | + public function __construct(stdClass | null $object = null) { |
|
43 | 43 | if ($object != null) { |
44 | 44 | parent::__construct($object, self::subs); |
45 | 45 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | public string $description; |
19 | 19 | |
20 | 20 | |
21 | - public function __construct(stdClass|null $object = null) { |
|
21 | + public function __construct(stdClass | null $object = null) { |
|
22 | 22 | if ($object != null) { |
23 | 23 | parent::__construct($object, self::subs); |
24 | 24 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | public bool $allow_channel_chats; |
32 | 32 | |
33 | 33 | |
34 | - public function __construct(stdClass|null $object = null) { |
|
34 | + public function __construct(stdClass | null $object = null) { |
|
35 | 35 | if ($object != null) { |
36 | 36 | parent::__construct($object, self::subs); |
37 | 37 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * under <file_attach_name> name. Animated and video stickers can't be uploaded via HTTP URL. More information on |
20 | 20 | * Sending Files » |
21 | 21 | */ |
22 | - public string|CURLFile $sticker; |
|
22 | + public string | CURLFile $sticker; |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * List of 1-20 emoji associated with the sticker |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | public array $keywords; |
39 | 39 | |
40 | 40 | |
41 | - public function __construct(stdClass|null $object = null) { |
|
41 | + public function __construct(stdClass | null $object = null) { |
|
42 | 42 | if ($object != null) { |
43 | 43 | parent::__construct($object, self::subs); |
44 | 44 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | public string $start_parameter; |
34 | 34 | |
35 | 35 | |
36 | - public function __construct(stdClass|null $object = null) { |
|
36 | + public function __construct(stdClass | null $object = null) { |
|
37 | 37 | if ($object != null) { |
38 | 38 | parent::__construct($object, self::subs); |
39 | 39 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | public string $name; |
16 | 16 | |
17 | 17 | |
18 | - public function __construct(stdClass|null $object = null) { |
|
18 | + public function __construct(stdClass | null $object = null) { |
|
19 | 19 | if ($object != null) { |
20 | 20 | parent::__construct($object, self::subs); |
21 | 21 | } |