@@ -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 | } |
@@ -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 |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |