Passed
Push — main ( 1af2d8...36dc31 )
by Miaad
02:33
created
examples/wallet/bot.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
     const MAX_MONEY_DECIMAL = 2;
29 29
     const MAX_MONEY_LENGTH = 10;
30 30
 
31
-    public function __construct (array $settings) {
31
+    public function __construct(array $settings) {
32 32
         parent::__construct($settings);
33 33
     }
34 34
 
35
-    public function cryptoCallback (cryptoCallback $cryptoData) {
35
+    public function cryptoCallback(cryptoCallback $cryptoData) {
36 36
         $paid_amount = $cryptoData->paid_amount;
37 37
         $user_id = $cryptoData->user_id;
38 38
         $real_amount = $cryptoData->real_amount;
@@ -43,25 +43,25 @@  discard block
 block discarded – undo
43 43
         }
44 44
         if ($cryptoData->status === cryptoCallbackStatus::PARTIALLY_PAID) {
45 45
             $need_to_pay = $real_amount - $total_paid;
46
-            mysql::update('users', ['balance' => '+=' . $paid_amount], ['id' => $user_id], 1);
46
+            mysql::update('users', ['balance' => '+='.$paid_amount], ['id' => $user_id], 1);
47 47
             return $this->sendMessage(strReplace(['$amount' => $paid_amount, '$real_amount' => $real_amount, '$need_amount' => $need_to_pay], texts::PARTIALLY_PAID), $user_id);
48 48
         }
49 49
         if ($cryptoData->status === cryptoCallbackStatus::FINISHED) {
50 50
             if ($paid_amount != $total_paid) {
51 51
                 $old_amount = $total_paid - $paid_amount;
52
-                mysql::update('users', ['balance' => '+=' . $paid_amount], ['id' => $user_id], 1);
52
+                mysql::update('users', ['balance' => '+='.$paid_amount], ['id' => $user_id], 1);
53 53
                 return $this->sendMessage(strReplace(['$amount' => $total_paid, '$old_amount' => $old_amount, '$new_amount' => $paid_amount], texts::FINISHED_PARTIALLY), $user_id);
54 54
             }
55
-            mysql::update('users', ['balance' => '+=' . $paid_amount], ['id' => $user_id], 1);
55
+            mysql::update('users', ['balance' => '+='.$paid_amount], ['id' => $user_id], 1);
56 56
             return $this->sendMessage(strReplace(['$amount' => $paid_amount], texts::FINISHED), $user_id);
57 57
         }
58 58
         if ($cryptoData->status === cryptoCallbackStatus::EXTRA_PAID) {
59 59
             if ($paid_amount != $total_paid) {
60 60
                 $old_amount = $total_paid - $paid_amount;
61
-                mysql::update('users', ['balance' => '+=' . $paid_amount], ['id' => $user_id], 1);
61
+                mysql::update('users', ['balance' => '+='.$paid_amount], ['id' => $user_id], 1);
62 62
                 return $this->sendMessage(strReplace(['$amount' => $total_paid, '$real_amount' => $real_amount, '$old_amount' => $old_amount, '$new_amount' => $paid_amount], texts::EXTRA_PAID_PARTIALLY), $user_id);
63 63
             }
64
-            mysql::update('users', ['balance' => '+=' . $paid_amount], ['id' => $user_id], 1);
64
+            mysql::update('users', ['balance' => '+='.$paid_amount], ['id' => $user_id], 1);
65 65
             return $this->sendMessage(strReplace(['$amount' => $paid_amount, '$real_amount' => $real_amount], texts::EXTRA_PAID), $user_id);
66 66
         }
67 67
         if ($cryptoData->status === cryptoCallbackStatus::SUCCESS) {
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
         }
118 118
     }
119 119
 
120
-    public function message (message $update) {
120
+    public function message(message $update) {
121 121
         $text = $update->text ?? '';
122 122
 
123 123
         $user_id = $update->from->id;
@@ -216,12 +216,12 @@  discard block
 block discarded – undo
216 216
                 return $this->sendMessage(strReplace(['$max_transfer' => self::MAX_TRANSFER], texts::MAX_TRANSFER), answer: true);
217 217
             }
218 218
 
219
-            mysql::update('users', ['balance' => '+=' . $text], ['id' => $user->value], 1);
219
+            mysql::update('users', ['balance' => '+='.$text], ['id' => $user->value], 1);
220 220
             $this->sendMessage(strReplace(['$amount' => $text, '$id' => $user_id], texts::MONEY_RECEIVED), $user->value);
221 221
 
222 222
             mysql::insert('history', ['type', 'amount', 'date', 'user_id', 'target_id'], ['transfer', $text, time(), $user_id, $user->value]);
223 223
 
224
-            mysql::update('users', ['balance' => '-=' . $text, 'step' => 'main', 'value' => ''], ['id' => $user_id], 1);
224
+            mysql::update('users', ['balance' => '-='.$text, 'step' => 'main', 'value' => ''], ['id' => $user_id], 1);
225 225
             return $this->sendMessage(texts::TRANSFER_DONE, reply_markup: keyboards::START, answer: true);
226 226
         }
227 227
         if ($user->step === 'deposit') {
Please login to merge, or discard this patch.
src/receiver/receiver.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
             $ip = $ip ?? tools::remoteIP();
36 36
             if (!tools::isTelegram($ip)) {
37 37
                 if (!callback::process()) {
38
-                    logger::write('not authorized access denied. IP : '. $ip ?? 'unknown',loggerTypes::WARNING);
38
+                    logger::write('not authorized access denied. IP : '.$ip ?? 'unknown', loggerTypes::WARNING);
39 39
                     BPT::exit();
40 40
                 }
41 41
                 die('callback handler stole the process :(');
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         }
44 44
     }
45 45
 
46
-    protected static function processUpdate(string|stdClass|update $update = null): void {
46
+    protected static function processUpdate(string | stdClass | update $update = null): void {
47 47
         if (!is_object($update)) {
48 48
             $update = json_decode($update ?? file_get_contents('php://input'));
49 49
             if (!$update) {
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
             }
59 59
         }
60 60
 
61
-        if (settings::$use_types_classes && !is_a($update,'update')) {
61
+        if (settings::$use_types_classes && !is_a($update, 'update')) {
62 62
             $update = new update($update);
63 63
         }
64 64
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         db::save();
70 70
     }
71 71
 
72
-    protected static function setMessageExtra (stdClass|update &$update): void {
72
+    protected static function setMessageExtra(stdClass | update & $update): void {
73 73
         if (!isset($update->message->text) && !isset($update->edited_message->text)) {
74 74
             return;
75 75
         }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
             BPT::$handler->something_else(BPT::$update);
146 146
         }
147 147
         else {
148
-            logger::write('Update received but handlers are not set',loggerTypes::WARNING);
148
+            logger::write('Update received but handlers are not set', loggerTypes::WARNING);
149 149
         }
150 150
     }
151 151
 
Please login to merge, or discard this patch.
src/types/cryptoCallback.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -20,18 +20,18 @@
 block discarded – undo
20 20
     public string $description;
21 21
 
22 22
     /** @var int|float Real amount or known as requested amount */
23
-    public int|float $real_amount;
23
+    public int | float $real_amount;
24 24
 
25 25
     /** @var string Fiat currency(aka usd, euro, ...) */
26 26
     public string $currency;
27 27
 
28 28
     /** @var int|float Paid amount in this payment */
29
-    public int|float $paid_amount;
29
+    public int | float $paid_amount;
30 30
 
31 31
     /** @var int|float Total paid amount for the order id */
32
-    public int|float $total_paid;
32
+    public int | float $total_paid;
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
         }
Please login to merge, or discard this patch.
src/telegram/request/curl.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -17,17 +17,17 @@  discard block
 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) {
20
+    public static function init(string $method, array $data) {
21 21
         $info = self::getInfo($data);
22 22
         $data = $info['data'];
23 23
         $handler = $info['handler'];
24
-        self::setTimeout($data,$handler,$method);
24
+        self::setTimeout($data, $handler, $method);
25 25
         self::setData($data);
26 26
         $data['method'] = $method;
27 27
         curl_setopt($handler, CURLOPT_POSTFIELDS, $data);
28 28
         $result = curl_exec($handler);
29 29
         if (curl_errno($handler)) {
30
-            logger::write(curl_error($handler),loggerTypes::WARNING);
30
+            logger::write(curl_error($handler), loggerTypes::WARNING);
31 31
         }
32 32
         if ($info['token'] != settings::$token) {
33 33
             curl_close($handler);
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
             curl_setopt($curl_handler, CURLOPT_RETURNTRANSFER, true);
45 45
             curl_setopt($curl_handler, CURLOPT_SSL_VERIFYPEER, false);
46 46
         }
47
-        else{
47
+        else {
48 48
             $token = settings::$token;
49
-            if (!isset(self::$curl_handler)){
49
+            if (!isset(self::$curl_handler)) {
50 50
                 self::$curl_handler = curl_init(settings::$base_url."/bot$token/");
51 51
                 curl_setopt(self::$curl_handler, CURLOPT_RETURNTRANSFER, true);
52 52
                 curl_setopt(self::$curl_handler, CURLOPT_SSL_VERIFYPEER, false);
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
         ];
63 63
     }
64 64
 
65
-    private static function setTimeout(array &$data , CurlHandle $curl_handler,string $method): void {
65
+    private static function setTimeout(array &$data, CurlHandle $curl_handler, string $method): void {
66 66
         if (isset($data['forgot'])) {
67 67
             curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, settings::$forgot_time);
68 68
             unset($data['forgot']);
69 69
         }
70
-        elseif ($method === 'getUpdates' || $method === 'setWebhook'){
70
+        elseif ($method === 'getUpdates' || $method === 'setWebhook') {
71 71
             curl_setopt($curl_handler, CURLOPT_TIMEOUT_MS, 5000);
72 72
         }
73 73
         elseif (settings::$base_timeout > 0) {
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
     }
77 77
 
78 78
     private static function setData(array &$data): void {
79
-        foreach ($data as &$value){
80
-            if (is_array($value) || (is_object($value) && !is_a($value,'CURLFile'))){
79
+        foreach ($data as &$value) {
80
+            if (is_array($value) || (is_object($value) && !is_a($value, 'CURLFile'))) {
81 81
                 $value = json_encode($value);
82 82
             }
83 83
         }
Please login to merge, or discard this patch.
src/settings/easyJson.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      *
15 15
      * @return $this
16 16
      */
17
-    public function setGlobal (array $global): self {
17
+    public function setGlobal(array $global): self {
18 18
         $this->settings['global'] = $global;
19 19
         return $this;
20 20
     }
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
      *
25 25
      * @return $this
26 26
      */
27
-    public function setGroup (array $group): self {
27
+    public function setGroup(array $group): self {
28 28
         $this->settings['group'] = $group;
29 29
         return $this;
30 30
     }
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      *
35 35
      * @return $this
36 36
      */
37
-    public function setSuperGroup (array $supergroup): self {
37
+    public function setSuperGroup(array $supergroup): self {
38 38
         $this->settings['supergroup'] = $supergroup;
39 39
         return $this;
40 40
     }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      *
45 45
      * @return $this
46 46
      */
47
-    public function setChannel (array $channel): self {
47
+    public function setChannel(array $channel): self {
48 48
         $this->settings['channel'] = $channel;
49 49
         return $this;
50 50
     }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      *
55 55
      * @return $this
56 56
      */
57
-    public function setUser (array $user): self {
57
+    public function setUser(array $user): self {
58 58
         $this->settings['user'] = $user;
59 59
         return $this;
60 60
     }
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      *
65 65
      * @return $this
66 66
      */
67
-    public function setGroupUser (array $group_user): self {
67
+    public function setGroupUser(array $group_user): self {
68 68
         $this->settings['group_user'] = $group_user;
69 69
         return $this;
70 70
     }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     /**
73 73
      * @return array
74 74
      */
75
-    public function getSettings (): array {
75
+    public function getSettings(): array {
76 76
         return $this->settings;
77 77
     }
78 78
 }
79 79
\ No newline at end of file
Please login to merge, or discard this patch.
src/settings/easyIdpay.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -4,17 +4,17 @@
 block discarded – undo
4 4
 class easyIdpay {
5 5
     private array $settings = [];
6 6
 
7
-    public function setApiKey (string $api_key): self {
7
+    public function setApiKey(string $api_key): self {
8 8
         $this->settings['api_key'] = $api_key;
9 9
         return $this;
10 10
     }
11 11
 
12
-    public function setSandbox (string $sandbox): self {
12
+    public function setSandbox(string $sandbox): self {
13 13
         $this->settings['sandbox'] = $sandbox;
14 14
         return $this;
15 15
     }
16 16
 
17
-    public function getSettings (): array {
17
+    public function getSettings(): array {
18 18
         return $this->settings;
19 19
     }
20 20
 }
21 21
\ No newline at end of file
Please login to merge, or discard this patch.
src/settings/easyZarinpal.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,22 +4,22 @@
 block discarded – undo
4 4
 class easyZarinpal {
5 5
     private array $settings = [];
6 6
 
7
-    public function setSandbox (string $sandbox): self {
7
+    public function setSandbox(string $sandbox): self {
8 8
         $this->settings['sandbox'] = $sandbox;
9 9
         return $this;
10 10
     }
11 11
 
12
-    public function setZarinGate (string $zarin_gate): self {
12
+    public function setZarinGate(string $zarin_gate): self {
13 13
         $this->settings['zarin_gate'] = $zarin_gate;
14 14
         return $this;
15 15
     }
16 16
 
17
-    public function setMerchantId (int $merchant_id): self {
17
+    public function setMerchantId(int $merchant_id): self {
18 18
         $this->settings['merchant_id'] = $merchant_id;
19 19
         return $this;
20 20
     }
21 21
 
22
-    public function getSettings (): array {
22
+    public function getSettings(): array {
23 23
         return $this->settings;
24 24
     }
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
src/settings/easySQL.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      *
14 14
      * @return $this
15 15
      */
16
-    public function setHost (string $host): self {
16
+    public function setHost(string $host): self {
17 17
         $this->settings['host'] = $host;
18 18
         return $this;
19 19
     }
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      *
24 24
      * @return $this
25 25
      */
26
-    public function setPort (string $port): self {
26
+    public function setPort(string $port): self {
27 27
         $this->settings['port'] = $port;
28 28
         return $this;
29 29
     }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      *
34 34
      * @return $this
35 35
      */
36
-    public function setUsername (string $user): self {
36
+    public function setUsername(string $user): self {
37 37
         $this->settings['user'] = $user;
38 38
         return $this;
39 39
     }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
      *
44 44
      * @return $this
45 45
      */
46
-    public function setPassword (string $pass): self {
46
+    public function setPassword(string $pass): self {
47 47
         $this->settings['pass'] = $pass;
48 48
         return $this;
49 49
     }
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      *
54 54
      * @return $this
55 55
      */
56
-    public function setDBName (string $dbname): self {
56
+    public function setDBName(string $dbname): self {
57 57
         $this->settings['dbname'] = $dbname;
58 58
         return $this;
59 59
     }
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      *
64 64
      * @return $this
65 65
      */
66
-    public function setAutoProcess (bool $auto_process): self {
66
+    public function setAutoProcess(bool $auto_process): self {
67 67
         $this->settings['auto_process'] = $auto_process;
68 68
         return $this;
69 69
     }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      *
74 74
      * @return $this
75 75
      */
76
-    public function setAutoLoad (bool $auto_load): self {
76
+    public function setAutoLoad(bool $auto_load): self {
77 77
         $this->settings['auto_load'] = $auto_load;
78 78
         return $this;
79 79
     }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     /**
82 82
      * @return array
83 83
      */
84
-    public function getSettings (): array {
84
+    public function getSettings(): array {
85 85
         return $this->settings;
86 86
     }
87 87
 }
88 88
\ No newline at end of file
Please login to merge, or discard this patch.
src/settings/easyCrypto.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,22 +4,22 @@
 block discarded – undo
4 4
 class easyCrypto {
5 5
     private array $settings = [];
6 6
 
7
-    public function setApiKey (string $api_key): self {
7
+    public function setApiKey(string $api_key): self {
8 8
         $this->settings['api_key'] = $api_key;
9 9
         return $this;
10 10
     }
11 11
 
12
-    public function setIpnSecret (string $ipn_secret): self {
12
+    public function setIpnSecret(string $ipn_secret): self {
13 13
         $this->settings['ipn_secret'] = $ipn_secret;
14 14
         return $this;
15 15
     }
16 16
 
17
-    public function setRoundDecimal (int $round_decimal): self {
17
+    public function setRoundDecimal(int $round_decimal): self {
18 18
         $this->settings['round_decimal'] = $round_decimal;
19 19
         return $this;
20 20
     }
21 21
 
22
-    public function getSettings (): array {
22
+    public function getSettings(): array {
23 23
         return $this->settings;
24 24
     }
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.