Completed
Branch master (914e59)
by Kirill
02:00
created

UpdateReceiver   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 17
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A handleUpdate() 0 4 1
1
<?php
2
3
namespace AppBundle\UpdateReceiver;
4
5
use Shaygan\TelegramBotApiBundle\TelegramBotApi;
6
use Shaygan\TelegramBotApiBundle\Type\Update;
7
use Shaygan\TelegramBotApiBundle\UpdateReceiver\UpdateReceiverInterface;
8
9
class UpdateReceiver implements UpdateReceiverInterface
10
{
11
12
    private $config;
13
    private $telegramBotApi;
14
15
    public function __construct(TelegramBotApi $telegramBotApi, $config)
16
    {
17
        $this->telegramBotApi = $telegramBotApi;
18
        $this->config = $config;
19
    }
20
21
    public function handleUpdate(Update $update)
22
    {
23
        $this->telegramBotApi->sendMessage($message['chat']['id'], 'Hello from Buktopuha, %username%');
0 ignored issues
show
Bug introduced by
The variable $message does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
24
    }
25
}
26