PluginEventsTrait   A
last analyzed

Complexity

Total Complexity 13

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 13
eloc 25
c 1
b 0
f 0
dl 0
loc 77
rs 10

13 Methods

Rating   Name   Duplication   Size   Complexity  
A onUpdate() 0 3 1
A onChannelPost() 0 4 1
A onEditedChannelPost() 0 4 1
A onPoll() 0 4 1
A onCallbackQuery() 0 4 1
A onEditedMessage() 0 4 1
A onChosenInlineResult() 0 4 1
A onPreCheckoutQuery() 0 4 1
A onShippingQuery() 0 4 1
A onMessage() 0 4 1
A onPollAnswer() 0 4 1
A onInlineQuery() 0 4 1
A onWebAppData() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace TelegramBot\Traits;
5
6
use TelegramBot\Entities\CallbackQuery;
7
use TelegramBot\Entities\ChannelPost;
8
use TelegramBot\Entities\ChosenInlineResult;
9
use TelegramBot\Entities\EditedChannelPost;
10
use TelegramBot\Entities\EditedMessage;
11
use TelegramBot\Entities\InlineQuery;
12
use TelegramBot\Entities\Message;
13
use TelegramBot\Entities\Payments\PreCheckoutQuery;
14
use TelegramBot\Entities\Payments\ShippingQuery;
15
use TelegramBot\Entities\Poll;
16
use TelegramBot\Entities\PollAnswer;
17
use TelegramBot\Entities\Update;
18
use TelegramBot\Entities\WebAppData;
19
20
trait PluginEventsTrait
21
{
22
23
    public function onUpdate(Update $update): \Generator
24
    {
25
        yield $update;
26
    }
27
28
    public function onMessage(int $update_id, Message $message): \Generator
29
    {
30
        yield $update_id;
31
        yield $message;
32
    }
33
34
    public function onEditedMessage(int $update_id, EditedMessage $editedMessage): \Generator
35
    {
36
        yield $update_id;
37
        yield $editedMessage;
38
    }
39
40
    public function onChannelPost(int $update_id, ChannelPost $channelPost): \Generator
41
    {
42
        yield $update_id;
43
        yield $channelPost;
44
    }
45
46
    public function onEditedChannelPost(int $update_id, EditedChannelPost $editedChannelPost): \Generator
47
    {
48
        yield $update_id;
49
        yield $editedChannelPost;
50
    }
51
52
    public function onInlineQuery(int $update_id, InlineQuery $inlineQuery): \Generator
53
    {
54
        yield $update_id;
55
        yield $inlineQuery;
56
    }
57
58
    public function onChosenInlineResult(int $update_id, ChosenInlineResult $chosenInlineResult): \Generator
59
    {
60
        yield $update_id;
61
        yield $chosenInlineResult;
62
    }
63
64
    public function onCallbackQuery(int $update_id, CallbackQuery $callbackQuery): \Generator
65
    {
66
        yield $update_id;
67
        yield $callbackQuery;
68
    }
69
70
    public function onShippingQuery(int $update_id, ShippingQuery $shippingQuery): \Generator
71
    {
72
        yield $update_id;
73
        yield $shippingQuery;
74
    }
75
76
    public function onPreCheckoutQuery(int $update_id, PreCheckoutQuery $preCheckoutQuery): \Generator
77
    {
78
        yield $update_id;
79
        yield $preCheckoutQuery;
80
    }
81
82
    public function onPoll(int $update_id, Poll $poll): \Generator
83
    {
84
        yield $update_id;
85
        yield $poll;
86
    }
87
88
    public function onPollAnswer(int $update_id, PollAnswer $pollAnswer): \Generator
89
    {
90
        yield $update_id;
91
        yield $pollAnswer;
92
    }
93
94
    public function onWebAppData(WebAppData $webAppData): \Generator
95
    {
96
        yield $webAppData;
97
    }
98
99
}