Completed
Push — master ( e0be30...eaeab3 )
by Алексей
05:57
created

MessageEntry   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 32
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A to() 0 4 1
A withInlineKeyboard() 0 4 1
A text() 0 4 1
A withReplyKeyboard() 0 4 1
A hideReplyKeyboard() 0 4 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: akeinhell
5
 * Date: 06.11.2016
6
 * Time: 11:46
7
 */
8
9
namespace Telegram\Entry;
10
11
12
use Telegram\Base\BaseEntry;
13
14
/**
15
 * Class MessageEntry
16
 * @package Telegram\Entry
17
 */
18
class MessageEntry extends BaseEntry
19
{
20
    /**
21
     * @param int $chatId
22
     * @return MessageEntry
23
     */
24
    public function to($chatId): MessageEntry
25
    {
26
        return $this->set('chat_id', $chatId);
27
    }
28
29
    public function withInlineKeyboard(InlineKeyboard $keyboard): MessageEntry
30
    {
31
        return $this->set('inline_keyboard', $keyboard->toArray());
32
    }
33
34
    public function text($text): MessageEntry
35
    {
36
        return $this->set('text', $text);
37
    }
38
39
    public function withReplyKeyboard(ReplyKeyboardEntry $keyboard)
40
    {
41
        return $this->set('reply_markup', $keyboard);
42
    }
43
44
    public function hideReplyKeyboard()
45
    {
46
        return $this->set('reply_markup', json_encode(['hide_keyboard' => true]));
47
    }
48
49
}