@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | private static CurlHandle $session; |
27 | 27 | |
28 | - public static function init (string $merchant_id = '', bool $sandbox = false, bool $zarin_gate = false): void { |
|
28 | + public static function init(string $merchant_id = '', bool $sandbox = false, bool $zarin_gate = false): void { |
|
29 | 29 | self::$sandbox = settings::$pay['zarinpal']['sandbox'] ?? $sandbox; |
30 | 30 | self::$zarin_gate = settings::$pay['zarinpal']['zarin_gate'] ?? settings::$pay['zarinpal']['zaringate'] ?? $zarin_gate; |
31 | 31 | self::$merchant_id = settings::$pay['zarinpal']['merchant_id'] ?? $merchant_id; |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | curl_setopt(self::$session, CURLOPT_POST, true); |
41 | 41 | } |
42 | 42 | |
43 | - private static function getUrl (string $endpoint, bool $pay = false): string { |
|
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 | 46 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | return $url; |
55 | 55 | } |
56 | 56 | |
57 | - private static function execute (string $endpoint, array $params = []): object { |
|
57 | + private static function execute(string $endpoint, array $params = []): object { |
|
58 | 58 | foreach ($params as $key => $value) { |
59 | 59 | if (empty($value)) { |
60 | 60 | unset($params[$key]); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | /** |
89 | 89 | * @return object|requestInterface |
90 | 90 | */ |
91 | - 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 | + 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 { |
|
92 | 92 | return self::execute('/request.json', [ |
93 | 93 | 'amount' => $amount, |
94 | 94 | 'description' => $description, |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | ]); |
103 | 103 | } |
104 | 104 | |
105 | - public static function payURL (string|array $authority): bool|string { |
|
105 | + public static function payURL(string | array $authority): bool | string { |
|
106 | 106 | if (is_array($authority)) { |
107 | 107 | if (!isset($authority->authority)) { |
108 | 108 | return false; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | /** |
116 | 116 | * @return object|verifyInterface |
117 | 117 | */ |
118 | - public static function verify (int $amount, string $authority): object { |
|
118 | + public static function verify(int $amount, string $authority): object { |
|
119 | 119 | return self::execute('/verify.json', [ |
120 | 120 | 'amount' => $amount, |
121 | 121 | 'authority' => $authority |
@@ -125,14 +125,14 @@ discard block |
||
125 | 125 | /** |
126 | 126 | * @return object|unverifiedInterface |
127 | 127 | */ |
128 | - public static function unVerified (): object { |
|
128 | + public static function unVerified(): object { |
|
129 | 129 | return self::execute('/unVerified.json'); |
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
133 | 133 | * @return object|refundInterface |
134 | 134 | */ |
135 | - public static function refund (string $authorization, string $authority): object { |
|
135 | + public static function refund(string $authorization, string $authority): object { |
|
136 | 136 | return self::execute('/refund.json', [ |
137 | 137 | 'authorization' => $authorization, |
138 | 138 | 'authority' => $authority |
@@ -140,12 +140,12 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | #[NoReturn] |
143 | - public static function redirect (string $url): void { |
|
144 | - @header('Location: ' . $url); |
|
143 | + public static function redirect(string $url): void { |
|
144 | + @header('Location: '.$url); |
|
145 | 145 | die("<meta http-equiv='refresh' content='0; url=$url' /><script>window.location.href = '$url';</script>"); |
146 | 146 | } |
147 | 147 | |
148 | - public static function processCallback (int $amount): object|bool|int { |
|
148 | + public static function processCallback(int $amount): object | bool | int { |
|
149 | 149 | if (!isset($_GET['Authority']) || !isset($_GET['Status'])) { |
150 | 150 | return false; |
151 | 151 | } |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | public int $duration; |
29 | 29 | |
30 | 30 | /** Optional. Video thumbnail */ |
31 | - public null|photoSize $thumbnail = null; |
|
31 | + public null | photoSize $thumbnail = null; |
|
32 | 32 | |
33 | 33 | /** Optional. File size in bytes */ |
34 | - public null|int $file_size = null; |
|
34 | + public null | int $file_size = null; |
|
35 | 35 | |
36 | 36 | |
37 | - public function __construct(stdClass|null $object = null) { |
|
37 | + public function __construct(stdClass | null $object = null) { |
|
38 | 38 | if ($object != null) { |
39 | 39 | parent::__construct($object, self::subs); |
40 | 40 | } |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @return bool|string string will be returned when destination doesn't set |
57 | 57 | */ |
58 | - public function download(string|null $destination = null): bool|string { |
|
59 | - return telegram::downloadFile($destination ?? 'unknown.mp4',$this->file_id); |
|
58 | + public function download(string | null $destination = null): bool | string { |
|
59 | + return telegram::downloadFile($destination ?? 'unknown.mp4', $this->file_id); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | public function link(): string { |
@@ -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 | } |
@@ -31,23 +31,23 @@ discard block |
||
31 | 31 | public int $duration; |
32 | 32 | |
33 | 33 | /** Optional. Animation thumbnail as defined by sender */ |
34 | - public null|photoSize $thumbnail = null; |
|
34 | + public null | photoSize $thumbnail = null; |
|
35 | 35 | |
36 | 36 | /** Optional. Original animation filename as defined by sender */ |
37 | - public null|string $file_name = null; |
|
37 | + public null | string $file_name = null; |
|
38 | 38 | |
39 | 39 | /** Optional. MIME type of the file as defined by sender */ |
40 | - public null|string $mime_type = null; |
|
40 | + public null | string $mime_type = null; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have |
44 | 44 | * difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit |
45 | 45 | * integer or double-precision float type are safe for storing this value. |
46 | 46 | */ |
47 | - public null|int $file_size = null; |
|
47 | + public null | int $file_size = null; |
|
48 | 48 | |
49 | 49 | |
50 | - public function __construct(stdClass|null $object = null) { |
|
50 | + public function __construct(stdClass | null $object = null) { |
|
51 | 51 | if ($object != null) { |
52 | 52 | parent::__construct($object, self::subs); |
53 | 53 | } |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return bool|string string will be returned when destination doesn't set |
70 | 70 | */ |
71 | - public function download(string|null $destination = null): bool|string { |
|
72 | - return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.gif',$this->file_id); |
|
71 | + public function download(string | null $destination = null): bool | string { |
|
72 | + return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.gif', $this->file_id); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | public function link(): string { |
@@ -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 | } |
@@ -25,29 +25,29 @@ discard block |
||
25 | 25 | public int $duration; |
26 | 26 | |
27 | 27 | /** Optional. Performer of the audio as defined by sender or by audio tags */ |
28 | - public null|string $performer = null; |
|
28 | + public null | string $performer = null; |
|
29 | 29 | |
30 | 30 | /** Optional. Title of the audio as defined by sender or by audio tags */ |
31 | - public null|string $title = null; |
|
31 | + public null | string $title = null; |
|
32 | 32 | |
33 | 33 | /** Optional. Original filename as defined by sender */ |
34 | - public null|string $file_name = null; |
|
34 | + public null | string $file_name = null; |
|
35 | 35 | |
36 | 36 | /** Optional. MIME type of the file as defined by sender */ |
37 | - public null|string $mime_type = null; |
|
37 | + public null | string $mime_type = null; |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have |
41 | 41 | * difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit |
42 | 42 | * integer or double-precision float type are safe for storing this value. |
43 | 43 | */ |
44 | - public null|int $file_size = null; |
|
44 | + public null | int $file_size = null; |
|
45 | 45 | |
46 | 46 | /** Optional. Thumbnail of the album cover to which the music file belongs */ |
47 | - public null|photoSize $thumbnail = null; |
|
47 | + public null | photoSize $thumbnail = null; |
|
48 | 48 | |
49 | 49 | |
50 | - public function __construct(stdClass|null $object = null) { |
|
50 | + public function __construct(stdClass | null $object = null) { |
|
51 | 51 | if ($object != null) { |
52 | 52 | parent::__construct($object, self::subs); |
53 | 53 | } |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return bool|string string will be returned when destination doesn't set |
70 | 70 | */ |
71 | - public function download(string|null $destination = null): bool|string { |
|
72 | - return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp3',$this->file_id); |
|
71 | + public function download(string | null $destination = null): bool | string { |
|
72 | + return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp3', $this->file_id); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | public function link(): string { |
@@ -31,23 +31,23 @@ discard block |
||
31 | 31 | public int $duration; |
32 | 32 | |
33 | 33 | /** Optional. Video thumbnail */ |
34 | - public null|photoSize $thumbnail = null; |
|
34 | + public null | photoSize $thumbnail = null; |
|
35 | 35 | |
36 | 36 | /** Optional. Original filename as defined by sender */ |
37 | - public null|string $file_name = null; |
|
37 | + public null | string $file_name = null; |
|
38 | 38 | |
39 | 39 | /** Optional. MIME type of the file as defined by sender */ |
40 | - public null|string $mime_type = null; |
|
40 | + public null | string $mime_type = null; |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have |
44 | 44 | * difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit |
45 | 45 | * integer or double-precision float type are safe for storing this value. |
46 | 46 | */ |
47 | - public null|int $file_size = null; |
|
47 | + public null | int $file_size = null; |
|
48 | 48 | |
49 | 49 | |
50 | - public function __construct(stdClass|null $object = null) { |
|
50 | + public function __construct(stdClass | null $object = null) { |
|
51 | 51 | if ($object != null) { |
52 | 52 | parent::__construct($object, self::subs); |
53 | 53 | } |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return bool|string string will be returned when destination doesn't set |
70 | 70 | */ |
71 | - public function download(string|null $destination = null): bool|string { |
|
72 | - return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp4',$this->file_id); |
|
71 | + public function download(string | null $destination = null): bool | string { |
|
72 | + return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.mp4', $this->file_id); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | public function link(): string { |
@@ -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 | } |
@@ -22,23 +22,23 @@ discard block |
||
22 | 22 | public string $file_unique_id; |
23 | 23 | |
24 | 24 | /** Optional. Document thumbnail as defined by sender */ |
25 | - public null|photoSize $thumbnail = null; |
|
25 | + public null | photoSize $thumbnail = null; |
|
26 | 26 | |
27 | 27 | /** Optional. Original filename as defined by sender */ |
28 | - public null|string $file_name = null; |
|
28 | + public null | string $file_name = null; |
|
29 | 29 | |
30 | 30 | /** Optional. MIME type of the file as defined by sender */ |
31 | - public null|string $mime_type = null; |
|
31 | + public null | string $mime_type = null; |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Optional. File size in bytes. It can be bigger than 2^31 and some programming languages may have |
35 | 35 | * difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit |
36 | 36 | * integer or double-precision float type are safe for storing this value. |
37 | 37 | */ |
38 | - public null|int $file_size = null; |
|
38 | + public null | int $file_size = null; |
|
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 | } |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @return bool|string string will be returned when destination doesn't set |
61 | 61 | */ |
62 | - public function download(string|null $destination = null): bool|string { |
|
63 | - return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.txt',$this->file_id); |
|
62 | + public function download(string | null $destination = null): bool | string { |
|
63 | + return telegram::downloadFile($destination ?? $this->file_name ?? 'unknown.txt', $this->file_id); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | public function link(): string { |