@@ -18,10 +18,10 @@ |
||
18 | 18 | public int $icon_color; |
19 | 19 | |
20 | 20 | /** Optional. Unique identifier of the custom emoji shown as the topic icon */ |
21 | - public null|string $icon_custom_emoji_id = null; |
|
21 | + public null | string $icon_custom_emoji_id = null; |
|
22 | 22 | |
23 | 23 | |
24 | - public function __construct(stdClass|null $object = null) { |
|
24 | + public function __construct(stdClass | null $object = null) { |
|
25 | 25 | if ($object != null) { |
26 | 26 | parent::__construct($object, self::subs); |
27 | 27 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | /** |
18 | 18 | * @internal Only for BPT self usage , Don't use it in your source! |
19 | 19 | */ |
20 | - public static function init (): void { |
|
20 | + public static function init(): void { |
|
21 | 21 | if (!isset(settings::$db['type'])) { |
22 | 22 | settings::$db['type'] = dbTypes::JSON; |
23 | 23 | } |
@@ -15,10 +15,10 @@ |
||
15 | 15 | public string $name; |
16 | 16 | |
17 | 17 | /** Optional. New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed */ |
18 | - public null|string $icon_custom_emoji_id = null; |
|
18 | + public null | string $icon_custom_emoji_id = null; |
|
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 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | /** Keep all of properties which has sub properties */ |
12 | 12 | private const subs = []; |
13 | 13 | |
14 | - public function __construct(stdClass|null $object = null) { |
|
14 | + public function __construct(stdClass | null $object = null) { |
|
15 | 15 | if ($object != null) { |
16 | 16 | parent::__construct($object, self::subs); |
17 | 17 | } |
@@ -11,7 +11,7 @@ |
||
11 | 11 | /** Keep all of properties which has sub properties */ |
12 | 12 | private const subs = []; |
13 | 13 | |
14 | - public function __construct(stdClass|null $object = null) { |
|
14 | + public function __construct(stdClass | null $object = null) { |
|
15 | 15 | if ($object != null) { |
16 | 16 | parent::__construct($object, self::subs); |
17 | 17 | } |
@@ -17,40 +17,40 @@ |
||
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 $method,array $data): bool { |
|
20 | + public static function init(string $method, array $data): bool { |
|
21 | 21 | self::checkWebhook(); |
22 | 22 | self::sieveData($data); |
23 | 23 | self::$is_answered = true; |
24 | 24 | $data['method'] = $method; |
25 | 25 | $payload = json_encode($data); |
26 | - header('Content-Type: application/json;Content-Length: ' . strlen($payload)); |
|
26 | + header('Content-Type: application/json;Content-Length: '.strlen($payload)); |
|
27 | 27 | echo $payload; |
28 | 28 | return true; |
29 | 29 | } |
30 | 30 | |
31 | - public static function isAnswered (): bool { |
|
31 | + public static function isAnswered(): bool { |
|
32 | 32 | return self::$is_answered; |
33 | 33 | } |
34 | 34 | |
35 | 35 | private static function checkWebhook(): void { |
36 | - if(settings::$receiver === receiver::GETUPDATES) { |
|
37 | - logger::write('Answer mode only work when receiver is webhook',loggerTypes::ERROR); |
|
36 | + if (settings::$receiver === receiver::GETUPDATES) { |
|
37 | + logger::write('Answer mode only work when receiver is webhook', loggerTypes::ERROR); |
|
38 | 38 | throw new bptException('ANSWER_MODE_GETUPDATES'); |
39 | 39 | } |
40 | - if(settings::$multi) { |
|
41 | - logger::write('You can not use answer mode when multi setting is on',loggerTypes::ERROR); |
|
40 | + if (settings::$multi) { |
|
41 | + logger::write('You can not use answer mode when multi setting is on', loggerTypes::ERROR); |
|
42 | 42 | throw new bptException('ANSWER_MODE_MULTI'); |
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
46 | 46 | private static function sieveData(array &$data): void { |
47 | - unset($data['token'],$data['forgot'],$data['return_array']); |
|
47 | + unset($data['token'], $data['forgot'], $data['return_array']); |
|
48 | 48 | |
49 | - foreach ($data as $key=>&$value){ |
|
50 | - if (!isset($value)){ |
|
49 | + foreach ($data as $key=>&$value) { |
|
50 | + if (!isset($value)) { |
|
51 | 51 | unset($data[$key]); |
52 | 52 | } |
53 | - elseif (is_array($value) || is_object($value)){ |
|
53 | + elseif (is_array($value) || is_object($value)) { |
|
54 | 54 | $value = json_encode($value); |
55 | 55 | } |
56 | 56 | } |
@@ -49,8 +49,7 @@ |
||
49 | 49 | foreach ($data as $key=>&$value){ |
50 | 50 | if (!isset($value)){ |
51 | 51 | unset($data[$key]); |
52 | - } |
|
53 | - elseif (is_array($value) || is_object($value)){ |
|
52 | + } elseif (is_array($value) || is_object($value)){ |
|
54 | 53 | $value = json_encode($value); |
55 | 54 | } |
56 | 55 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * telegram class , Adding normal method call to request class and a simple name for being easy to call |
7 | 7 | */ |
8 | 8 | class telegram extends request { |
9 | - public function __call (string $name, array $arguments) { |
|
9 | + public function __call(string $name, array $arguments) { |
|
10 | 10 | return request::$name(...$arguments); |
11 | 11 | } |
12 | 12 | } |
13 | 13 | \ No newline at end of file |
@@ -56,7 +56,7 @@ |
||
56 | 56 | public bool $bot_is_member; |
57 | 57 | |
58 | 58 | |
59 | - public function __construct(stdClass|null $object = null) { |
|
59 | + public function __construct(stdClass | null $object = null) { |
|
60 | 60 | if ($object != null) { |
61 | 61 | parent::__construct($object, self::subs); |
62 | 62 | } |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return bool|int |
37 | 37 | */ |
38 | - public static function save(string $name, string $data): bool|int { |
|
39 | - return file_put_contents(settings::$name."$name.lock", $data) && chmod(settings::$name."$name.lock",0640); |
|
38 | + public static function save(string $name, string $data): bool | int { |
|
39 | + return file_put_contents(settings::$name."$name.lock", $data) && chmod(settings::$name."$name.lock", 0640); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return bool|string |
48 | 48 | */ |
49 | - public static function read(string $name): bool|string { |
|
49 | + public static function read(string $name): bool | string { |
|
50 | 50 | return file_get_contents(realpath(settings::$name."$name.lock")); |
51 | 51 | } |
52 | 52 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @return bool|int |
59 | 59 | */ |
60 | - public static function mtime(string $name): bool|int { |
|
60 | + public static function mtime(string $name): bool | int { |
|
61 | 61 | return filemtime(realpath(settings::$name."$name.lock")); |
62 | 62 | } |
63 | 63 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @return bool |
81 | 81 | */ |
82 | - public static function deleteIfExist (string|array $names): bool { |
|
82 | + public static function deleteIfExist(string | array $names): bool { |
|
83 | 83 | if (is_string($names)) { |
84 | 84 | $names = [$names]; |
85 | 85 | } |