Completed
Push — master ( 253eb0...a11462 )
by
unknown
04:22
created

PreCheckoutQuery::getID()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 5
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 5
loc 5
rs 9.4285
c 0
b 0
f 0
ccs 0
cts 4
cp 0
cc 1
eloc 2
nc 1
nop 0
crap 2
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\Entities;
20
21
/**
22
 * \addtogroup Entities Entities
23
 * \brief Telegram Entities.
24
 * @{
25
 */
26
27
/** \class PreCheckoutQuery
28
 * \brief This object represents an incoming PreCheckout query.
29
 */
30 View Code Duplication
class PreCheckoutQuery implements \ArrayAccess
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...
31
{
32
33
    /** @} */
34
35
    use EntityAccess;
36
37
    /**
38
     * \brief Get payload for the current invoice's checkout.
39
     * @return string $payload The invoice's payload.
40
     */
41
    public function getPayload() : string
42
    {
43
        return $this->container['invoice_payload'];
44
    }
45
46
    /**
47
     * \brief Get chat ID of the chat where the message comes from.
48
     * @return $chat_id Chat ID.
0 ignored issues
show
Documentation introduced by
The doc-type $chat_id could not be parsed: Unknown type name "$chat_id" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
49
     */
50
    public function getChatID()
51
    {
52
        return isset($this->container['from']) ? $this->container['from']['id'] : null;
53
    }
54
55
56
    /**
57
     * \brief (<i>Internal</i>) Get parameter to set to the bot.
58
     * \details Each time the bot receive a query,
59
     * the parameter _pre_checkout_query_id will be set to the ID of this callback.
60
     * @return array Array with the parameter name as "var" index, and the id in "id" index.
61
     */
62
    public function getBotParameter() : array
63
    {
64
        return ['var' => '_pre_checkout_query_id', 'id' => $this->container['id']];
65
    }
66
67
    /**
68
     * \brief Get ID of this callback query.
69
     * @return int $id ID of the callback.
70
     */
71
    public function getID() : int
72
    {
73
74
        return $this->container['id'];
75
    }
76
}
77