Passed
Pull Request — master (#314)
by Eldar
02:38
created

BotCommand   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 65
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 65
loc 65
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getCommand() 4 4 1
A setCommand() 4 4 1
A getDescription() 4 4 1
A setDescription() 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
use TelegramBot\Api\TypeInterface;
7
8 View Code Duplication
class BotCommand extends BaseType implements TypeInterface
9
{
10
    /**
11
     * {@inheritdoc}
12
     *
13
     * @var array
14
     */
15
    static protected $requiredParams = ['command', 'description'];
16
17
    /**
18
     * {@inheritdoc}
19
     *
20
     * @var array
21
     */
22
    static protected $map = [
23
        'command' => true,
24
        'description' => true,
25
    ];
26
27
    /**
28
     * Text of the command, 1-32 characters. Can contain only lowercase English letters, digits and underscores.
29
     *
30
     * @var string
31
     */
32
    protected $command;
33
34
    /**
35
     * Description of the command, 3-256 characters.
36
     *
37
     * @var string
38
     */
39
    protected $description;
40
41
    /**
42
     * @return string
43
     */
44 2
    public function getCommand()
45
    {
46 2
        return $this->command;
47
    }
48
49
    /**
50
     * @param string $command
51
     */
52 3
    public function setCommand($command)
53
    {
54 3
        $this->command = $command;
55 3
    }
56
57
    /**
58
     * @return string
59
     */
60 2
    public function getDescription()
61
    {
62 2
        return $this->description;
63
    }
64
65
    /**
66
     * @param string $description
67
     */
68 3
    public function setDescription($description)
69
    {
70 3
        $this->description = $description;
71 3
    }
72
}
73