Completed
Push — master ( 69097b...4e1c03 )
by Danilo
04:33
created

TestBot   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 23
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A processMessage() 0 7 1
A initCommandsWrap() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the PhpBotFramework.
5
 *
6
 * PhpBotFramework is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU Lesser General Public License as
8
 * published by the Free Software Foundation, version 3.
9
 *
10
 * PhpBotFramework is distributed in the hope that it will be useful, but
11
 * WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
 * Lesser General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Lesser General Public License
16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
 */
18
19
namespace PhpBotFramework\Test;
20
21
use PhpBotFramework\Bot;
22
23
use PhpBotFramework\Entities\Message;
24
25
class TestBot extends Bot
26
{
27
    use FakeUpdate;
28
29
    public $message_id = 0;
30
31
    /*
32
     * \brief Process a message sending it to the user specified internally.
33
     * @param Message $message The message to send to the user.
34
     */
35 2
    public function processMessage(Message $message)
36
    {
37 2
        $this->setChatID(getenv("CHAT_ID"));
38 2
        $this->sendMessage("Message from <b>{$message['from']['first_name']}</b> saying: <i>{$message['text']}</i>");
39
40 2
        $this->message_id = $message['message_id'];
41 2
    }
42
43 3
    public function initCommandsWrap()
44
    {
45 3
        $this->initCommands();
46 3
    }
47
}
48