TelegramBot   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 8
dl 0
loc 25
c 0
b 0
f 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A isMessage() 0 3 1
A isOwner() 0 3 1
A isNotifyChat() 0 8 2
A isCallback() 0 3 1
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