Passed
Push — master ( 6140a2...ff30ae )
by
unknown
09:50
created

ReplyKeyboardRemove   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 75
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 75
loc 75
ccs 0
cts 21
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 5 5 1
A getRemoveKeyboard() 4 4 1
A setRemoveKeyboard() 4 4 1
A getSelective() 4 4 1
A setSelective() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace TelegramBot\Api\Types;
4
5
use TelegramBot\Api\BaseType;
6
7
/**
8
 * Class ReplyKeyboardRemove
9
 * Upon receiving a message with this object,
10
 * Telegram clients will remove the current custom keyboard and display the default letter-keyboard.
11
 *
12
 * @package TelegramBot\Api\Types
13
 */
14 View Code Duplication
class ReplyKeyboardRemove extends BaseType
15
{
16
    /**
17
     * {@inheritdoc}
18
     *
19
     * @var array
20
     */
21
    static protected $requiredParams = ['remove_keyboard'];
22
23
    /**
24
     * {@inheritdoc}
25
     *
26
     * @var array
27
     */
28
    static protected $map = [
29
        'remove_keyboard' => true,
30
        'selective' => true
31
    ];
32
33
    /**
34
     * Requests clients to remove the custom keyboard (user will not be able to summon this keyboard;
35
     * if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup)
36
     *
37
     * @var bool
38
     */
39
    protected $remove_keyboard;
40
41
    /**
42
     * Optional. Use this parameter if you want to remove the keyboard for specific users only.
43
     * Targets:
44
     * 1) users that are @mentioned in the text of the Message object;
45
     * 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
46
     *
47
     * @var bool
48
     */
49
    protected $selective;
50
51
    public function __construct($remove_keyboard = true, $selective = false)
52
    {
53
        $this->remove_keyboard = $remove_keyboard;
54
        $this->selective = $selective;
55
    }
56
57
    /**
58
     * @return bool
59
     */
60
    public function getRemoveKeyboard()
61
    {
62
        return $this->remove_keyboard;
63
    }
64
65
    /**
66
     * @param bool $remove_keyboard
67
     */
68
    public function setRemoveKeyboard($remove_keyboard)
69
    {
70
        $this->remove_keyboard = $remove_keyboard;
71
    }
72
73
    /**
74
     * @return bool
75
     */
76
    public function getSelective()
77
    {
78
        return $this->selective;
79
    }
80
81
    /**
82
     * @param bool $selective
83
     */
84
    public function setSelective($selective)
85
    {
86
        $this->selective = $selective;
87
    }
88
}
89