TelegramBot::isCallback()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace CSlant\TelegramGitNotifier\Structures;
4
5
use Telegram;
6
7
trait TelegramBot
8
{
9
    public function isCallback(): bool
10
    {
11
        return $this->telegram->getUpdateType() === Telegram::CALLBACK_QUERY;
12
    }
13
14
    public function isMessage(): bool
15
    {
16
        return $this->telegram->getUpdateType() === Telegram::MESSAGE;
17
    }
18
19
    public function isOwner(): bool
20
    {
21
        return $this->telegram->ChatID() == $this->chatBotId;
22
    }
23
24
    public function isNotifyChat(): bool
25
    {
26
        $chatIds = config('telegram-git-notifier.bot.notify_chat_ids');
27
        if (in_array($this->telegram->ChatID(), $chatIds)) {
28
            return true;
29
        }
30
31
        return false;
32
    }
33
}
34