Passed
Push — main ( e0778d...2e4cb3 )
by Miaad
10:42
created
src/types/generalForumTopicUnhidden.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/types/generalForumTopicHidden.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/telegram/request/answer.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -17,40 +17,40 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,8 +49,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/telegram/telegram.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
src/lock.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/pay/idpay.php 2 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -92,11 +92,9 @@
 block discarded – undo
92 92
     public static function processCallback (): bool|int {
93 93
         if ($_SERVER['REQUEST_METHOD'] === 'POST') {
94 94
             $response = $_POST;
95
-        }
96
-        elseif ($_SERVER['REQUEST_METHOD'] === 'GET') {
95
+        } elseif ($_SERVER['REQUEST_METHOD'] === 'GET') {
97 96
             $response = $_GET;
98
-        }
99
-        else {
97
+        } else {
100 98
             return false;
101 99
         }
102 100
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -13,20 +13,20 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/pay/zarinpal.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@
 block discarded – undo
43 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
-        }
47
-        else {
46
+        } else {
48 47
             $url = self::$sandbox ? self::SANDBOX_API_BASE : self::API_BASE;
49 48
         }
50 49
         $url .= $endpoint;
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     private static CurlHandle $session;
26 26
 
27
-    public static function init (string $merchant_id = '', bool $sandbox = false, bool $zarin_gate = false): void {
27
+    public static function init(string $merchant_id = '', bool $sandbox = false, bool $zarin_gate = false): void {
28 28
         self::$sandbox = $sandbox;
29 29
         self::$zarin_gate = $zarin_gate;
30 30
         self::$merchant_id = $merchant_id;
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         curl_setopt(self::$session, CURLOPT_POST, true);
40 40
     }
41 41
 
42
-    private static function getUrl (string $endpoint, bool $pay = false): string {
42
+    private static function getUrl(string $endpoint, bool $pay = false): string {
43 43
         if ($pay) {
44 44
             $url = self::$sandbox ? self::SANDBOX_PAY_BASE : self::PAY_BASE;
45 45
         }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         return $url;
54 54
     }
55 55
 
56
-    private static function execute (string $endpoint, array $params = []): object {
56
+    private static function execute(string $endpoint, array $params = []): object {
57 57
         foreach ($params as $key => $value) {
58 58
             if (empty($value)) {
59 59
                 unset($params[$key]);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     /**
88 88
      * @return object|requestInterface
89 89
      */
90
-    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 {
90
+    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 91
         return self::execute('/request.json', [
92 92
             'amount'       => $amount,
93 93
             'description'  => $description,
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         ]);
102 102
     }
103 103
 
104
-    public static function payURL (string|array $authority): bool|string {
104
+    public static function payURL(string | array $authority): bool | string {
105 105
         if (is_array($authority)) {
106 106
             if (!isset($authority->authority)) {
107 107
                 return false;
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     /**
115 115
      * @return object|verifyInterface
116 116
      */
117
-    public static function verify (int $amount, string $authority): object {
117
+    public static function verify(int $amount, string $authority): object {
118 118
         return self::execute('/verify.json', [
119 119
             'amount'    => $amount,
120 120
             'authority' => $authority
@@ -124,14 +124,14 @@  discard block
 block discarded – undo
124 124
     /**
125 125
      * @return object|unverifiedInterface
126 126
      */
127
-    public static function unVerified (): object {
127
+    public static function unVerified(): object {
128 128
         return self::execute('/unVerified.json');
129 129
     }
130 130
 
131 131
     /**
132 132
      * @return object|refundInterface
133 133
      */
134
-    public static function refund (string $authorization, string $authority): object {
134
+    public static function refund(string $authorization, string $authority): object {
135 135
         return self::execute('/refund.json', [
136 136
             'authorization' => $authorization,
137 137
             'authority'     => $authority
@@ -139,12 +139,12 @@  discard block
 block discarded – undo
139 139
     }
140 140
 
141 141
     #[NoReturn]
142
-    public static function redirect (string $url): void {
143
-        @header('Location: ' . $url);
142
+    public static function redirect(string $url): void {
143
+        @header('Location: '.$url);
144 144
         die("<meta http-equiv='refresh' content='0; url=$url' /><script>window.location.href = '$url';</script>");
145 145
     }
146 146
 
147
-    public static function processCallback (int $amount): object|bool|int {
147
+    public static function processCallback(int $amount): object | bool | int {
148 148
         if (!isset($_GET['Authority']) || !isset($_GET['Status'])) {
149 149
             return false;
150 150
         }
Please login to merge, or discard this patch.
src/types/inputMedia.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/types/botShortDescription.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.