@@ -13,20 +13,20 @@ discard block |
||
13 | 13 | |
14 | 14 | private static CurlHandle $session; |
15 | 15 | |
16 | - public static function init (string $api_key = '', bool $sandbox = false): void { |
|
16 | + public static function init(string $api_key = '', bool $sandbox = false): void { |
|
17 | 17 | self::$session = curl_init(); |
18 | 18 | curl_setopt(self::$session, CURLOPT_RETURNTRANSFER, true); |
19 | 19 | curl_setopt(self::$session, CURLOPT_SSL_VERIFYPEER, 1); |
20 | 20 | curl_setopt(self::$session, CURLOPT_SSL_VERIFYHOST, 2); |
21 | 21 | curl_setopt(self::$session, CURLOPT_HTTPHEADER, [ |
22 | 22 | 'Content-Type: application/json', |
23 | - 'X-API-KEY: ' . $api_key, |
|
24 | - 'X-SANDBOX: ' . (int) ($sandbox), |
|
23 | + 'X-API-KEY: '.$api_key, |
|
24 | + 'X-SANDBOX: '.(int) ($sandbox), |
|
25 | 25 | ]); |
26 | 26 | curl_setopt(self::$session, CURLOPT_POST, true); |
27 | 27 | } |
28 | 28 | |
29 | - private static function execute (string $endpoint, array $params) { |
|
29 | + private static function execute(string $endpoint, array $params) { |
|
30 | 30 | foreach ($params as $key => $value) { |
31 | 31 | if (empty($value)) { |
32 | 32 | unset($params[$key]); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $session = self::$session; |
37 | 37 | |
38 | 38 | curl_setopt($session, CURLOPT_POSTFIELDS, json_encode($params)); |
39 | - curl_setopt($session, CURLOPT_URL, self::API_BASE . $endpoint); |
|
39 | + curl_setopt($session, CURLOPT_URL, self::API_BASE.$endpoint); |
|
40 | 40 | |
41 | 41 | return json_decode(curl_exec($session)); |
42 | 42 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | /** |
45 | 45 | * @return paymentCreateInterface|errorInterface|object|bool |
46 | 46 | */ |
47 | - public static function createPayment (string $order_id, int $amount, string $name = '', string $phone = '', string $mail = '', string $desc = '', string $callback = ''): object|bool { |
|
47 | + public static function createPayment(string $order_id, int $amount, string $name = '', string $phone = '', string $mail = '', string $desc = '', string $callback = ''): object | bool { |
|
48 | 48 | return self::execute('payment', [ |
49 | 49 | 'order_id' => $order_id, |
50 | 50 | 'amount' => $amount, |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * @return paymentInterface|errorInterface|object|bool |
61 | 61 | */ |
62 | - public static function paymentDetail (string $id, string $order_id): object { |
|
62 | + public static function paymentDetail(string $id, string $order_id): object { |
|
63 | 63 | return self::execute('payment/inquiry', [ |
64 | 64 | 'order_id' => $order_id, |
65 | 65 | 'id' => $id |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * @return paymentInterface|errorInterface|object|bool |
71 | 71 | */ |
72 | - public static function paymentConfirm (string $id, string $order_id): object { |
|
72 | + public static function paymentConfirm(string $id, string $order_id): object { |
|
73 | 73 | return self::execute('payment/verify', [ |
74 | 74 | 'order_id' => $order_id, |
75 | 75 | 'id' => $id |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | /** |
80 | 80 | * @return paymentListInterface|errorInterface|object|bool |
81 | 81 | */ |
82 | - public static function paymentList (int $page = 0, int $page_size = 25): object { |
|
82 | + public static function paymentList(int $page = 0, int $page_size = 25): object { |
|
83 | 83 | return self::execute('payment/transactions', [ |
84 | 84 | 'page' => $page, |
85 | 85 | 'page_size' => $page_size |
86 | 86 | ]); |
87 | 87 | } |
88 | 88 | |
89 | - public static function processCallback (): bool|int { |
|
89 | + public static function processCallback(): bool | int { |
|
90 | 90 | if ($_SERVER['REQUEST_METHOD'] === 'POST') { |
91 | 91 | $response = $_POST; |
92 | 92 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | private static CurlHandle $session; |
37 | 37 | |
38 | - public static function init (string $api_key = '', string $ipn_secret = '', int $round_decimal = 4): void { |
|
38 | + public static function init(string $api_key = '', string $ipn_secret = '', int $round_decimal = 4): void { |
|
39 | 39 | self::$ipn_secret = $ipn_secret; |
40 | 40 | self::$round_decimal = $round_decimal; |
41 | 41 | self::$session = curl_init(); |
@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | curl_setopt(self::$session, CURLOPT_SSL_VERIFYPEER, 1); |
44 | 44 | curl_setopt(self::$session, CURLOPT_SSL_VERIFYHOST, 2); |
45 | 45 | curl_setopt(self::$session, CURLOPT_HTTPHEADER, [ |
46 | - 'X-API-KEY: ' . $api_key, |
|
46 | + 'X-API-KEY: '.$api_key, |
|
47 | 47 | 'Content-Type: application/json' |
48 | 48 | ]); |
49 | 49 | } |
50 | 50 | |
51 | - private static function execute (string $method, string $endpoint, string|array $data = '') { |
|
51 | + private static function execute(string $method, string $endpoint, string | array $data = '') { |
|
52 | 52 | if (is_array($data)) { |
53 | 53 | foreach ($data as $key => $value) { |
54 | 54 | if (empty($value)) { |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | |
62 | 62 | switch ($method) { |
63 | 63 | case 'GET': |
64 | - curl_setopt($session, CURLOPT_URL, self::API_BASE . $endpoint . (!empty($data) && is_array($data) ? ('?' . http_build_query($data)) : '')); |
|
64 | + curl_setopt($session, CURLOPT_URL, self::API_BASE.$endpoint.(!empty($data) && is_array($data) ? ('?'.http_build_query($data)) : '')); |
|
65 | 65 | break; |
66 | 66 | case 'POST': |
67 | 67 | curl_setopt($session, CURLOPT_POST, true); |
68 | 68 | curl_setopt($session, CURLOPT_POSTFIELDS, json_encode($data)); |
69 | - curl_setopt($session, CURLOPT_URL, self::API_BASE . $endpoint); |
|
69 | + curl_setopt($session, CURLOPT_URL, self::API_BASE.$endpoint); |
|
70 | 70 | break; |
71 | 71 | default: |
72 | 72 | return false; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * This is a method to get information about the current state of the API. Receive true if its ok and false in otherwise |
79 | 79 | * @return bool |
80 | 80 | */ |
81 | - public static function status (): bool { |
|
81 | + public static function status(): bool { |
|
82 | 82 | return self::execute('GET', 'status')->message === 'OK'; |
83 | 83 | } |
84 | 84 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @return estimatePriceInterface|errorResponseInterface|mixed |
95 | 95 | */ |
96 | - public static function getEstimatePrice (int|float $amount, string $currency_from, string $currency_to) { |
|
96 | + public static function getEstimatePrice(int | float $amount, string $currency_from, string $currency_to) { |
|
97 | 97 | return self::execute('GET', 'estimate', [ |
98 | 98 | 'amount' => $amount, |
99 | 99 | 'currency_from' => $currency_from, |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return invoicePaymentInterface|errorResponseInterface|mixed |
122 | 122 | */ |
123 | - public static function createPayment (int|float $price_amount, string $price_currency, string $pay_currency, int|float $pay_amount = null, string $ipn_callback_url = null, string $order_id = null, string $order_description = null, string $purchase_id = null, string $payout_address = null, string $payout_currency = null, string $payout_extra_id = null, bool $fixed_rate = null, bool $is_fee_paid_by_user = null) { |
|
123 | + public static function createPayment(int | float $price_amount, string $price_currency, string $pay_currency, int | float $pay_amount = null, string $ipn_callback_url = null, string $order_id = null, string $order_description = null, string $purchase_id = null, string $payout_address = null, string $payout_currency = null, string $payout_extra_id = null, bool $fixed_rate = null, bool $is_fee_paid_by_user = null) { |
|
124 | 124 | return self::execute('POST', 'payment', [ |
125 | 125 | 'price_amount' => $price_amount, |
126 | 126 | 'price_currency' => $price_currency, |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return invoicePaymentInterface|errorResponseInterface|mixed |
154 | 154 | */ |
155 | - public static function createInvoicePayment (string $iid, string $pay_currency, string $purchase_id = null, string $order_description = null, string $customer_email = null, string $payout_address = null, string $payout_extra_id = null, string $payout_currency = null) { |
|
155 | + public static function createInvoicePayment(string $iid, string $pay_currency, string $purchase_id = null, string $order_description = null, string $customer_email = null, string $payout_address = null, string $payout_extra_id = null, string $payout_currency = null) { |
|
156 | 156 | return self::execute('POST', 'invoice-payment', [ |
157 | 157 | 'iid' => $iid, |
158 | 158 | 'pay_currency' => $pay_currency, |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @return estimateUpdateInterface|errorResponseInterface|mixed |
175 | 175 | */ |
176 | - public static function updateEstimatePrice (int $paymentID) { |
|
177 | - return self::execute('POST', 'payment/' . $paymentID . '/update-merchant-estimate'); |
|
176 | + public static function updateEstimatePrice(int $paymentID) { |
|
177 | + return self::execute('POST', 'payment/'.$paymentID.'/update-merchant-estimate'); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -184,8 +184,8 @@ discard block |
||
184 | 184 | * |
185 | 185 | * @return paymentInterface|errorResponseInterface|mixed |
186 | 186 | */ |
187 | - public static function getPaymentStatus (int $paymentID) { |
|
188 | - return self::execute('GET', 'payment/' . $paymentID); |
|
187 | + public static function getPaymentStatus(int $paymentID) { |
|
188 | + return self::execute('GET', 'payment/'.$paymentID); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return float |
198 | 198 | */ |
199 | - public static function getMinimumPaymentAmount (string $currency_from, string $currency_to): float { |
|
199 | + public static function getMinimumPaymentAmount(string $currency_from, string $currency_to): float { |
|
200 | 200 | return self::execute('GET', 'min-amount', [ |
201 | 201 | 'currency_from' => $currency_from, |
202 | 202 | 'currency_to' => $currency_to |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @return invoiceResponseInterface|errorResponseInterface|mixed |
219 | 219 | */ |
220 | - public static function createInvoice (int|float $price_amount, string $price_currency, string $pay_currency = null, string $ipn_callback_url = null, string $order_id = null, string $order_description = null, string $success_url = null, string $cancel_url = null) { |
|
220 | + public static function createInvoice(int | float $price_amount, string $price_currency, string $pay_currency = null, string $ipn_callback_url = null, string $order_id = null, string $order_description = null, string $success_url = null, string $cancel_url = null) { |
|
221 | 221 | return self::execute('POST', 'invoice', [ |
222 | 222 | 'price_amount' => $price_amount, |
223 | 223 | 'price_currency' => $price_currency, |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @return array |
237 | 237 | */ |
238 | - public static function getCurrencies (): array { |
|
238 | + public static function getCurrencies(): array { |
|
239 | 239 | return self::execute('GET', 'currencies')->currencies; |
240 | 240 | } |
241 | 241 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * |
245 | 245 | * @return array |
246 | 246 | */ |
247 | - public static function getFullCurrencies (): array { |
|
247 | + public static function getFullCurrencies(): array { |
|
248 | 248 | return self::execute('GET', 'full-currencies')->currencies; |
249 | 249 | } |
250 | 250 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * |
255 | 255 | * @return array |
256 | 256 | */ |
257 | - public static function getAvailableCheckedCurrencies (): array { |
|
257 | + public static function getAvailableCheckedCurrencies(): array { |
|
258 | 258 | return self::execute('GET', 'merchant/coins')->currencies; |
259 | 259 | } |
260 | 260 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * |
273 | 273 | * @return bool |
274 | 274 | */ |
275 | - public static function isIPNRequestValid (): bool { |
|
275 | + public static function isIPNRequestValid(): bool { |
|
276 | 276 | if (empty($_SERVER['HTTP_X_NOWPAYMENTS_SIG'])) { |
277 | 277 | return false; |
278 | 278 | } |
@@ -294,14 +294,14 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @return ipnDataInterface|mixed |
296 | 296 | */ |
297 | - public static function getIPN () { |
|
297 | + public static function getIPN() { |
|
298 | 298 | if (!self::isIPNRequestValid()) { |
299 | 299 | return false; |
300 | 300 | } |
301 | 301 | return json_decode(file_get_contents('php://input')); |
302 | 302 | } |
303 | 303 | |
304 | - protected static function createOrder (float|int $amount, int $user_id, string $description): int|string { |
|
304 | + protected static function createOrder(float | int $amount, int $user_id, string $description): int | string { |
|
305 | 305 | if (!mysql::getMysqli()) { |
306 | 306 | logger::write("crypto::ezPay function used\ncreating order needed mysql connection in our mysql class", loggerTypes::ERROR); |
307 | 307 | throw new bptException('MYSQL_CONNECTION_NEEDED'); |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | return mysql::insertId(); |
313 | 313 | } |
314 | 314 | |
315 | - protected static function getOrder (int $order_id): bool|object { |
|
315 | + protected static function getOrder(int $order_id): bool | object { |
|
316 | 316 | if (!mysql::getMysqli()) { |
317 | 317 | logger::write("crypto::ezPay function used\ncreating order needed mysql connection in our mysql class", loggerTypes::ERROR); |
318 | 318 | throw new bptException('MYSQL_CONNECTION_NEEDED'); |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | * @return bool|string |
344 | 344 | * @throws bptException |
345 | 345 | */ |
346 | - public static function ezPay (float|int $amount, int $user_id = null, string $currency = 'usd', string $description = 'Invoice created by BPT library', bool $direct_url = false, bool $one_time_url = true): bool|string { |
|
346 | + public static function ezPay(float | int $amount, int $user_id = null, string $currency = 'usd', string $description = 'Invoice created by BPT library', bool $direct_url = false, bool $one_time_url = true): bool | string { |
|
347 | 347 | if (empty(self::$ipn_secret)) { |
348 | 348 | logger::write("crypto::ezPay function used\nyou must set ipn_secret to use this", loggerTypes::ERROR); |
349 | 349 | return false; |
@@ -355,10 +355,10 @@ discard block |
||
355 | 355 | $user_id = $user_id ?? request::catchFields(fields::USER_ID); |
356 | 356 | $order_id = self::createOrder($amount, $user_id, $description); |
357 | 357 | $data = ['type' => callbackTypes::CRYPTO, 'action_type' => cryptoCallbackActionTypes::CALLBACK, 'amount' => $amount, 'currency' => $currency, 'user_id' => $user_id, 'order_id' => $order_id]; |
358 | - $callback_url = 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . '?data='.urlencode(callback::encodeData($data)); |
|
358 | + $callback_url = 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'].'?data='.urlencode(callback::encodeData($data)); |
|
359 | 359 | |
360 | 360 | $data = ['type' => callbackTypes::CRYPTO, 'action_type' => cryptoCallbackActionTypes::SUCCESS, 'amount' => $amount, 'currency' => $currency, 'user_id' => $user_id, 'order_id' => $order_id]; |
361 | - $success_url = 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . '?data='.urlencode(callback::encodeData($data)); |
|
361 | + $success_url = 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'].'?data='.urlencode(callback::encodeData($data)); |
|
362 | 362 | |
363 | 363 | $invoice_id = self::createInvoice($amount, $currency, null, $callback_url, $order_id, $description, $success_url)->id; |
364 | 364 | |
@@ -377,17 +377,17 @@ discard block |
||
377 | 377 | ], ['id' => $order_id], 1); |
378 | 378 | |
379 | 379 | if ($direct_url) { |
380 | - return 'https://nowpayments.io/payment/?iid='. $invoice_id; |
|
380 | + return 'https://nowpayments.io/payment/?iid='.$invoice_id; |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | $data = ['type' => callbackTypes::CRYPTO, 'action_type' => cryptoCallbackActionTypes::REDIRECT, 'amount' => $amount, 'currency' => $currency, 'user_id' => $user_id, 'order_id' => $order_id]; |
384 | - return 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] . '?data='.urlencode(callback::encodeData($data)); |
|
384 | + return 'https://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'].'?data='.urlencode(callback::encodeData($data)); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | /** |
388 | 388 | * @internal Only for BPT self usage , Don't use it in your source! |
389 | 389 | */ |
390 | - public static function callbackProcess (array $data) { |
|
390 | + public static function callbackProcess(array $data) { |
|
391 | 391 | if (!isset($data['action_type'])) { |
392 | 392 | return false; |
393 | 393 | } |
@@ -407,16 +407,16 @@ discard block |
||
407 | 407 | BPT::exit('This link is one time only, Receive another link'); |
408 | 408 | } |
409 | 409 | } |
410 | - $url = 'https://nowpayments.io/payment/?iid='. $extra_info->invoice_id; |
|
410 | + $url = 'https://nowpayments.io/payment/?iid='.$extra_info->invoice_id; |
|
411 | 411 | |
412 | - @header('Location: ' . $url); |
|
412 | + @header('Location: '.$url); |
|
413 | 413 | die("<meta http-equiv='refresh' content='0; url=$url' /><script>window.location.href = '$url';</script>"); |
414 | 414 | } |
415 | 415 | |
416 | 416 | if ($action_type === cryptoCallbackActionTypes::CALLBACK) { |
417 | 417 | $ipn = self::getIPN(); |
418 | 418 | |
419 | - if ($ipn->payment_status !== cryptoStatus::FINISHED && $ipn->payment_status !== cryptoStatus::PARTIALLY_PAID ) { |
|
419 | + if ($ipn->payment_status !== cryptoStatus::FINISHED && $ipn->payment_status !== cryptoStatus::PARTIALLY_PAID) { |
|
420 | 420 | die(); |
421 | 421 | } |
422 | 422 | |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | die(); |
439 | 439 | } |
440 | 440 | |
441 | - $paid = round(isset($payment->actually_paid_at_fiat) && $payment->actually_paid_at_fiat > 0 ? $payment->actually_paid_at_fiat : $payment->actually_paid/$payment->pay_amount*$payment->price_amount, self::$round_decimal); |
|
441 | + $paid = round(isset($payment->actually_paid_at_fiat) && $payment->actually_paid_at_fiat > 0 ? $payment->actually_paid_at_fiat : $payment->actually_paid / $payment->pay_amount * $payment->price_amount, self::$round_decimal); |
|
442 | 442 | $extra_info['related_payments'][$payment_id] = $paid; |
443 | 443 | $extra_info['total_paid'] += $paid; |
444 | 444 | mysql::update('orders', ['extra_info' => json_encode($extra_info)], ['id' => $order_id], 1); |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | 'description' => $order->description, |
501 | 501 | 'real_amount' => $order->amount, |
502 | 502 | 'currency' => $extra_info->currency, |
503 | - 'paid_amount' => round(isset($payment->actually_paid_at_fiat) && $payment->actually_paid_at_fiat > 0 ? $payment->actually_paid_at_fiat : $payment->actually_paid/$payment->pay_amount*$payment->price_amount, self::$round_decimal), |
|
503 | + 'paid_amount' => round(isset($payment->actually_paid_at_fiat) && $payment->actually_paid_at_fiat > 0 ? $payment->actually_paid_at_fiat : $payment->actually_paid / $payment->pay_amount * $payment->price_amount, self::$round_decimal), |
|
504 | 504 | 'total_paid' => $extra_info->total_paid |
505 | 505 | ]; |
506 | 506 | $callback_data = object(...$callback_data); |
@@ -5,7 +5,7 @@ |
||
5 | 5 | use BPT\settings; |
6 | 6 | |
7 | 7 | class pay { |
8 | - public static function init (): void { |
|
8 | + public static function init(): void { |
|
9 | 9 | if (isset(settings::$pay['crypto'])) { |
10 | 10 | $settings = [ |
11 | 11 | 'api_key' => settings::$pay['crypto']['api_key'] ?? null, |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @internal Only for BPT self usage , Don't use it in your source! |
19 | 19 | */ |
20 | - public static function init (string $bot_name, int $log_size = 10): void { |
|
20 | + public static function init(string $bot_name, int $log_size = 10): void { |
|
21 | 21 | self::$log_size = $log_size; |
22 | 22 | $log_file = realpath($bot_name.'BPT.log'); |
23 | 23 | $mode = file_exists($log_file) && self::$log_size * 1024 * 1024 > filesize($log_file) ? 'a' : 'w'; |
24 | 24 | self::$handler = fopen($bot_name.'BPT.log', $mode); |
25 | 25 | if ($mode === 'w') { |
26 | - fwrite(self::$handler,"♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nTnx for using our library\nSome information about us :\nAuthor : @Im_Miaad\nHelper : @A_LiReza_ME\nChannel : @BPT_CH\nOur Website : https://bptlib.ir\n\nIf you have any problem with our library\nContact to our supports\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nINFO : BPT Library LOG STARTED ...\nwarning : this file automatically deleted when its size reached log_size setting, do not delete it manually\n\n"); |
|
26 | + fwrite(self::$handler, "♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nTnx for using our library\nSome information about us :\nAuthor : @Im_Miaad\nHelper : @A_LiReza_ME\nChannel : @BPT_CH\nOur Website : https://bptlib.ir\n\nIf you have any problem with our library\nContact to our supports\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥ BPT Library ♥♥♥♥♥♥♥♥♥♥♥♥♥♥\nINFO : BPT Library LOG STARTED ...\nwarning : this file automatically deleted when its size reached log_size setting, do not delete it manually\n\n"); |
|
27 | 27 | } |
28 | 28 | if (self::$waited_logs != []) { |
29 | 29 | foreach (self::$waited_logs as $log) { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return void |
44 | 44 | */ |
45 | 45 | public static function write(string $data, string $type = loggerTypes::NONE): void { |
46 | - $text = date('Y/m/d H:i:s') . ($type !== loggerTypes::NONE ? " : ⤵\n$type" : '') . " : $data\n\n"; |
|
46 | + $text = date('Y/m/d H:i:s').($type !== loggerTypes::NONE ? " : ⤵\n$type" : '')." : $data\n\n"; |
|
47 | 47 | if (!is_null(self::$handler)) { |
48 | 48 | fwrite(self::$handler, $text); |
49 | 49 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | public array $user_ids; |
28 | 28 | |
29 | 29 | |
30 | - public function __construct(stdClass|null $object = null) { |
|
30 | + public function __construct(stdClass | null $object = null) { |
|
31 | 31 | if ($object != null) { |
32 | 32 | parent::__construct($object, self::subs); |
33 | 33 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @param bool|null $answer |
40 | 40 | */ |
41 | - public function getInfo (bool $answer = null): array { |
|
41 | + public function getInfo(bool $answer = null): array { |
|
42 | 42 | $result = []; |
43 | 43 | foreach ($this->user_ids as $user_id) { |
44 | 44 | $result[$user_id] = telegram::getChat($user_id, answer: $answer); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * spoiler, and custom_emoji entities are kept in quotes. |
20 | 20 | * @var messageEntity[] |
21 | 21 | */ |
22 | - public null|array $entities = null; |
|
22 | + public null | array $entities = null; |
|
23 | 23 | |
24 | 24 | /** Approximate quote position in the original message in UTF-16 code units as specified by the sender */ |
25 | 25 | public int $position; |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | * Optional. True, if the quote was chosen manually by the message sender. Otherwise, the quote was added |
29 | 29 | * automatically by the server. |
30 | 30 | */ |
31 | - public null|bool $is_manual = null; |
|
31 | + public null | bool $is_manual = null; |
|
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 | } |
@@ -18,19 +18,19 @@ |
||
18 | 18 | public string $message_text; |
19 | 19 | |
20 | 20 | /** Optional. Mode for parsing entities in the message text. See formatting options for more details. */ |
21 | - public null|string $parse_mode = null; |
|
21 | + public null | string $parse_mode = null; |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Optional. List of special entities that appear in message text, which can be specified instead of parse_mode |
25 | 25 | * @var messageEntity[] |
26 | 26 | */ |
27 | - public null|array $entities = null; |
|
27 | + public null | array $entities = null; |
|
28 | 28 | |
29 | 29 | /** Optional. Link preview generation options for the message */ |
30 | - public null|linkPreviewOptions $link_preview_options = null; |
|
30 | + public null | linkPreviewOptions $link_preview_options = null; |
|
31 | 31 | |
32 | 32 | |
33 | - public function __construct(stdClass|null $object = null) { |
|
33 | + public function __construct(stdClass | null $object = null) { |
|
34 | 34 | if ($object != null) { |
35 | 35 | parent::__construct($object, self::subs); |
36 | 36 | } |
@@ -24,13 +24,13 @@ discard block |
||
24 | 24 | public int $winner_count; |
25 | 25 | |
26 | 26 | /** Optional. True, if only users who join the chats after the giveaway started should be eligible to win */ |
27 | - public null|bool $only_new_members = null; |
|
27 | + public null | bool $only_new_members = null; |
|
28 | 28 | |
29 | 29 | /** Optional. True, if the list of giveaway winners will be visible to everyone */ |
30 | - public null|bool $has_public_winners = null; |
|
30 | + public null | bool $has_public_winners = null; |
|
31 | 31 | |
32 | 32 | /** Optional. Description of additional giveaway prize */ |
33 | - public null|string $prize_description = null; |
|
33 | + public null | string $prize_description = null; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Optional. A list of two-letter ISO 3166-1 alpha-2 country codes indicating the countries from which eligible |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | * number that was bought on Fragment can always participate in giveaways. |
39 | 39 | * @var string[] |
40 | 40 | */ |
41 | - public null|array $country_codes = null; |
|
41 | + public null | array $country_codes = null; |
|
42 | 42 | |
43 | 43 | /** Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for */ |
44 | - public null|int $premium_subscription_month_count = null; |
|
44 | + public null | int $premium_subscription_month_count = null; |
|
45 | 45 | |
46 | 46 | |
47 | - public function __construct(stdClass|null $object = null) { |
|
47 | + public function __construct(stdClass | null $object = null) { |
|
48 | 48 | if ($object != null) { |
49 | 49 | parent::__construct($object, self::subs); |
50 | 50 | } |
@@ -19,19 +19,19 @@ |
||
19 | 19 | * Or User(gift_code) for which the gift code was created |
20 | 20 | * Or User(giveaway) that won the prize in the giveaway if any |
21 | 21 | */ |
22 | - public null|user $user = null; |
|
22 | + public null | user $user = null; |
|
23 | 23 | |
24 | 24 | /** |
25 | 25 | * `giveaway` only. Identifier of a message in the chat with the giveaway; the message could have been deleted |
26 | 26 | * already. May be 0 if the message isn't sent yet. |
27 | 27 | */ |
28 | - public null|int $giveaway_message_id = null; |
|
28 | + public null | int $giveaway_message_id = null; |
|
29 | 29 | |
30 | 30 | /** `giveaway` only. Optional. True, if the giveaway was completed, but there was no user to win the prize */ |
31 | - public null|bool $is_unclaimed = null; |
|
31 | + public null | bool $is_unclaimed = null; |
|
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 | } |