@@ -190,8 +190,9 @@ discard block |
||
190 | 190 | if (telegram::$status) { |
191 | 191 | $check = $check->status; |
192 | 192 | $result[$id] = $check !== chatMemberStatus::LEFT && $check !== chatMemberStatus::KICKED; |
193 | - } |
|
194 | - else $result[$id] = null; |
|
193 | + } else { |
|
194 | + $result[$id] = null; |
|
195 | + } |
|
195 | 196 | } |
196 | 197 | return $result; |
197 | 198 | } |
@@ -297,15 +298,15 @@ discard block |
||
297 | 298 | curl_exec($ch); |
298 | 299 | $size = curl_getinfo($ch, CURLINFO_CONTENT_LENGTH_DOWNLOAD); |
299 | 300 | curl_close($ch); |
300 | - } |
|
301 | - else { |
|
301 | + } else { |
|
302 | 302 | $size = file_exists($path) ? filesize($path) : false; |
303 | 303 | } |
304 | 304 | |
305 | 305 | if (isset($size) && is_numeric($size)) { |
306 | 306 | return $format ? tools::byteFormat($size) : $size; |
307 | - } |
|
308 | - else return false; |
|
307 | + } else { |
|
308 | + return false; |
|
309 | + } |
|
309 | 310 | } |
310 | 311 | |
311 | 312 | /** |
@@ -331,15 +332,16 @@ discard block |
||
331 | 332 | $file->isDir() ? rmdir($file->getRealPath()) : unlink($file->getRealPath()); |
332 | 333 | } |
333 | 334 | return rmdir($path); |
334 | - } |
|
335 | - else { |
|
335 | + } else { |
|
336 | 336 | logger::write("tools::delete function used\ndelete function cannot delete folder because its have subFiles and sub parameter haven't true value",loggerTypes::ERROR); |
337 | 337 | throw new bptException('DELETE_FOLDER_HAS_SUB'); |
338 | 338 | } |
339 | - } |
|
340 | - else return rmdir($path); |
|
341 | - } |
|
342 | - else return unlink($path); |
|
339 | + } else { |
|
340 | + return rmdir($path); |
|
341 | + } |
|
342 | + } else { |
|
343 | + return unlink($path); |
|
344 | + } |
|
343 | 345 | } |
344 | 346 | |
345 | 347 | /** |
@@ -371,8 +373,9 @@ discard block |
||
371 | 373 | foreach ($string as $k => &$v) { |
372 | 374 | if ($diff->$v) { |
373 | 375 | $v = $diff->$v; |
374 | - } |
|
375 | - else unset($string[$k]); |
|
376 | + } else { |
|
377 | + unset($string[$k]); |
|
378 | + } |
|
376 | 379 | } |
377 | 380 | $string['status'] = $status; |
378 | 381 | |
@@ -423,8 +426,7 @@ discard block |
||
423 | 426 | $iv = self::randomString(); |
424 | 427 | $output = base64_encode(openssl_encrypt($text, 'AES-256-CBC', $key, 1, $iv)); |
425 | 428 | return ['hash' => $output, 'key' => $key, 'iv' => $iv]; |
426 | - } |
|
427 | - elseif ($action === cryptoAction::DECRYPT) { |
|
429 | + } elseif ($action === cryptoAction::DECRYPT) { |
|
428 | 430 | if (empty($key)) { |
429 | 431 | logger::write("tools::crypto function used\nkey parameter is not set",loggerTypes::ERROR); |
430 | 432 | throw new bptException('ARGUMENT_NOT_FOUND_KEY'); |
@@ -434,13 +436,11 @@ discard block |
||
434 | 436 | throw new bptException('ARGUMENT_NOT_FOUND_IV'); |
435 | 437 | } |
436 | 438 | return openssl_decrypt(base64_decode($text), 'AES-256-CBC', $key, 1, $iv); |
437 | - } |
|
438 | - else { |
|
439 | + } else { |
|
439 | 440 | logger::write("tools::crypto function used\naction is not right, its must be `encode` or `decode`"); |
440 | 441 | return false; |
441 | 442 | } |
442 | - } |
|
443 | - else { |
|
443 | + } else { |
|
444 | 444 | logger::write("tools::crypto function used\nopenssl extension is not found , It may not be installed or enabled",loggerTypes::ERROR); |
445 | 445 | throw new bptException('OPENSSL_EXTENSION_MISSING'); |
446 | 446 | } |
@@ -461,7 +461,9 @@ discard block |
||
461 | 461 | */ |
462 | 462 | public static function zip (string $path, string $destination, bool $self = true, bool $sub_folder = true): bool { |
463 | 463 | if (extension_loaded('zip')) { |
464 | - if (file_exists($destination)) unlink($destination); |
|
464 | + if (file_exists($destination)) { |
|
465 | + unlink($destination); |
|
466 | + } |
|
465 | 467 | |
466 | 468 | $path = realpath($path); |
467 | 469 | $zip = new ZipArchive(); |
@@ -487,23 +489,19 @@ discard block |
||
487 | 489 | if ($file->isFile()){ |
488 | 490 | if ($sub_folder){ |
489 | 491 | $zip->addFile($file, str_replace($path . '\\', '', $file)); |
490 | - } |
|
491 | - else{ |
|
492 | + } else{ |
|
492 | 493 | $zip->addFile($file, basename($file)); |
493 | 494 | } |
494 | - } |
|
495 | - elseif ($file->isDir() && $sub_folder) { |
|
495 | + } elseif ($file->isDir() && $sub_folder) { |
|
496 | 496 | $zip->addEmptyDir(str_replace($path . '\\', '', $file . '\\')); |
497 | 497 | } |
498 | 498 | } |
499 | - } |
|
500 | - else{ |
|
499 | + } else{ |
|
501 | 500 | $zip->addFile($path, basename($path)); |
502 | 501 | } |
503 | 502 | |
504 | 503 | return $zip->close(); |
505 | - } |
|
506 | - else { |
|
504 | + } else { |
|
507 | 505 | logger::write("tools::zip function used\nzip extension is not found , It may not be installed or enabled",loggerTypes::ERROR); |
508 | 506 | throw new bptException('ZIP_EXTENSION_MISSING'); |
509 | 507 | } |
@@ -548,15 +546,12 @@ discard block |
||
548 | 546 | if (count($button_info) > 1) { |
549 | 547 | if ($button_info[1] === 'con') { |
550 | 548 | $button->setRequest_contact(true); |
551 | - } |
|
552 | - elseif ($button_info[1] === 'loc') { |
|
549 | + } elseif ($button_info[1] === 'loc') { |
|
553 | 550 | $button->setRequest_location(true); |
554 | - } |
|
555 | - elseif ($button_info[1] === 'poll') { |
|
551 | + } elseif ($button_info[1] === 'poll') { |
|
556 | 552 | $type = $button_info[2] === pollType::QUIZ ? pollType::QUIZ : pollType::REGULAR; |
557 | 553 | $button->setRequest_poll((new keyboardButtonPollType())->setType($type)); |
558 | - } |
|
559 | - elseif ($button_info[1] === 'web' && isset($button_info[2])) { |
|
554 | + } elseif ($button_info[1] === 'web' && isset($button_info[2])) { |
|
560 | 555 | $url = $button_info[2]; |
561 | 556 | $button->setWeb_app((new webAppInfo())->setUrl($url)); |
562 | 557 | } |
@@ -566,8 +561,7 @@ discard block |
||
566 | 561 | $keyboard_object->setKeyboard([$buttons]); |
567 | 562 | } |
568 | 563 | return $keyboard_object; |
569 | - } |
|
570 | - elseif (!empty($inline)) { |
|
564 | + } elseif (!empty($inline)) { |
|
571 | 565 | $keyboard_object = new inlineKeyboardMarkup(); |
572 | 566 | foreach ($inline as $row) { |
573 | 567 | $buttons = []; |
@@ -576,20 +570,17 @@ discard block |
||
576 | 570 | if (isset($button_info[1])) { |
577 | 571 | if (filter_var($button_info[1], FILTER_VALIDATE_URL) && str_starts_with($button_info[1], 'http')) { |
578 | 572 | $button->setText($button_info[0])->setUrl($button_info[1]); |
579 | - } |
|
580 | - else { |
|
573 | + } else { |
|
581 | 574 | $button->setText($button_info[0])->setCallback_data($button_info[1]); |
582 | 575 | } |
583 | - } |
|
584 | - else { |
|
576 | + } else { |
|
585 | 577 | $button->setText($button_info[0])->setUrl('https://t.me/BPT_CH'); |
586 | 578 | } |
587 | 579 | } |
588 | 580 | $keyboard_object->setInline_keyboard([$buttons]); |
589 | 581 | } |
590 | 582 | return $keyboard_object; |
591 | - } |
|
592 | - else { |
|
583 | + } else { |
|
593 | 584 | logger::write("tools::eKey function used\nkeyboard or inline parameter must be set",loggerTypes::ERROR); |
594 | 585 | throw new bptException('ARGUMENT_NOT_FOUND_KEYBOARD_INLINE'); |
595 | 586 | } |