Completed
Push — master ( c7f2a3...d5293b )
by Gusev
03:39 queued 52s
created

ChosenInlineResult   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 139
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 60%

Importance

Changes 3
Bugs 1 Features 2
Metric Value
wmc 10
c 3
b 1
f 2
lcom 0
cbo 1
dl 139
loc 139
ccs 15
cts 25
cp 0.6
rs 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A getResultId() 4 4 1
A setResultId() 4 4 1
A getFrom() 4 4 1
A setFrom() 4 4 1
A getLocation() 4 4 1
A setLocation() 4 4 1
A getInlineMessageId() 4 4 1
A setInlineMessageId() 4 4 1
A getQuery() 4 4 1
A setQuery() 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\Inline;
4
5
use TelegramBot\Api\BaseType;
6
use TelegramBot\Api\Types\Location;
7
use TelegramBot\Api\Types\User;
8
9
/**
10
 * Class ChosenInlineResult
11
 * This object represents a result of an inline query that was chosen by the user and sent to their chat partner.
12
 *
13
 * @package TelegramBot\Api\Types
14
 */
15 View Code Duplication
class ChosenInlineResult extends BaseType
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
{
17
    /**
18
     * {@inheritdoc}
19
     *
20
     * @var array
21
     */
22
    static protected $requiredParams = ['result_id', 'from', 'query'];
23
24
    /**
25
     * {@inheritdoc}
26
     *
27
     * @var array
28
     */
29
    static protected $map = [
30
        'result_id' => true,
31
        'from' => User::class,
32
        'location' => Location::class,
33
        'inline_message_id' => true,
34
        'query' => true,
35
    ];
36
37
    /**
38
     * The unique identifier for the result that was chosen.
39
     *
40
     * @var string
41
     */
42
    protected $resultId;
43
44
    /**
45
     * The user that chose the result.
46
     *
47
     * @var User
48
     */
49
    protected $from;
50
51
    /**
52
     * Optional. Sender location, only for bots that require user location
53
     *
54
     * @var Location
55
     */
56
    protected $location;
57
58
    /**
59
     * Optional. Identifier of the sent inline message.
60
     * Available only if there is an inline keyboard attached to the message.
61
     * Will be also received in callback queries and can be used to edit the message.
62
     *
63
     * @var string
64
     */
65
    protected $inlineMessageId;
66
67
    /**
68
     * The query that was used to obtain the result.
69
     *
70
     * @var string
71
     */
72
    protected $query;
73
74
    /**
75
     * @return string
76
     */
77 2
    public function getResultId()
78
    {
79 2
        return $this->resultId;
80
    }
81
82
    /**
83
     * @param string $resultId
84
     */
85 3
    public function setResultId($resultId)
86
    {
87 3
        $this->resultId = $resultId;
88 3
    }
89
90
    /**
91
     * @return User
92
     */
93 2
    public function getFrom()
94
    {
95 2
        return $this->from;
96
    }
97
98
    /**
99
     * @param User $from
100
     */
101 3
    public function setFrom(User $from)
102
    {
103 3
        $this->from = $from;
104 3
    }
105
106
    /**
107
     * @return Location
108
     */
109
    public function getLocation()
110
    {
111
        return $this->location;
112
    }
113
114
    /**
115
     * @param Location $location
116
     */
117
    public function setLocation($location)
118
    {
119
        $this->location = $location;
120
    }
121
122
    /**
123
     * @return string
124
     */
125
    public function getInlineMessageId()
126
    {
127
        return $this->inlineMessageId;
128
    }
129
130
    /**
131
     * @param string $inlineMessageId
132
     */
133
    public function setInlineMessageId($inlineMessageId)
134
    {
135
        $this->inlineMessageId = $inlineMessageId;
136
    }
137
138
    /**
139
     * @return string
140
     */
141 2
    public function getQuery()
142
    {
143 2
        return $this->query;
144
    }
145
146
    /**
147
     * @param string $query
148
     */
149 3
    public function setQuery($query)
150
    {
151 3
        $this->query = $query;
152 3
    }
153
}
154