Skip to content

Commit be2678f

Browse files
handle naming and some code SuppressWarnings
1 parent 8b4ca37 commit be2678f

File tree

8 files changed

+17
-20
lines changed

8 files changed

+17
-20
lines changed

phpmd.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121

2222
<rule ref="rulesets/codesize.xml"/>
2323

24-
<rule ref="rulesets/naming.xml"/>
25-
24+
<rule ref="rulesets/naming.xml">
25+
<exclude name="LongVariable"></exclude>
26+
</rule>
2627

2728
<rule ref="rulesets/design.xml" />
2829

src/Entities/Chat.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ public function __construct($data)
4040
{
4141
parent::__construct($data);
4242

43-
$id = $this->getId();
43+
$_id = $this->getId();
4444
$type = $this->getType();
4545
if (!$type) {
46-
$id > 0 && $this->type = 'private';
47-
$id < 0 && $this->type = 'group';
46+
$_id > 0 && $this->type = 'private';
47+
$_id < 0 && $this->type = 'group';
4848
}
4949
}
5050

src/Entities/Payments/PreCheckoutQuery.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ class PreCheckoutQuery extends Entity
3333
*
3434
* @return Response
3535
*/
36-
public function answer(bool $ok, array $data = []): Response
36+
public function answer(bool $_ok, array $data = []): Response
3737
{
3838
return Request::answerPreCheckoutQuery(array_merge([
3939
'pre_checkout_query_id' => $this->getId(),
40-
'ok' => $ok,
40+
'ok' => $_ok,
4141
], $data));
4242
}
4343

src/Entities/Payments/ShippingQuery.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ class ShippingQuery extends Entity
3030
*
3131
* @return Response
3232
*/
33-
public function answer(bool $ok, array $data = []): Response
33+
public function answer(bool $_ok, array $data = []): Response
3434
{
3535
return Request::answerShippingQuery(array_merge([
3636
'shipping_query_id' => $this->getId(),
37-
'ok' => $ok,
37+
'ok' => $_ok,
3838
], $data));
3939
}
4040

src/Entities/Response.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public function __construct(array $data)
4343
$this->response = $data;
4444

4545
$is_ok = (bool)($data['ok'] ?? false);
46-
$result = $data['result'] ?? null;
4746

4847
if ($is_ok) {
4948
foreach ($this->requiredFields as $field) {

src/Request.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,6 @@ class Request {
174174
*/
175175
private static string $api_base_uri = 'https://api.telegram.org';
176176

177-
/**
178-
* URI of the Telegram API for downloading files (relative to $api_base_url or absolute)
179-
*
180-
* @var string
181-
*/
182-
private static string $api_base_download_uri = '/file/bot{API_KEY}';
183-
184177
/**
185178
* The current action that is being executed
186179
*

src/Traits/HandlerTrait.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@
1515
trait HandlerTrait
1616
{
1717

18+
/**
19+
* @TODO @SuppressWarnings(PHPMD.UnusedFormalParameter)
20+
*/
1821
public function __process(Update $update): void
1922
{
2023
// TODO: Implement __process() method.
2124
}
2225

23-
}
26+
}

src/UpdateHandler.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ public function __construct(string $api_token = '') {
7171
* @param ?Update $update The custom to work with
7272
* @param array $config The configuration of the receiver
7373
* @return void
74+
75+
* @TODO @SuppressWarnings(PHPMD.UnusedFormalParameter)
7476
*/
7577
public static function resolveOn(Plugin $plugin, Update $update = null, array $config = []): void {
7678
// TODO: Implement resolveOn() method.
@@ -94,7 +96,6 @@ public function addPlugins(Plugin|array $plugins): UpdateHandler {
9496
);
9597
}
9698

97-
$reflection = Toolkit::reflectionClass($plugin);
9899
$this->plugins[] = [
99100
'class' => $plugin,
100101
'initialized' => is_object($plugin),
@@ -250,4 +251,4 @@ public function stop(): void {
250251
$this->active_spreader = false;
251252
}
252253

253-
}
254+
}

0 commit comments

Comments
 (0)