Completed
Push — master ( 8fbc07...04de59 )
by Armando
03:05 queued 01:27
created

ShippingQuery::answer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 0
cts 7
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
crap 2
1
<?php
2
/**
3
 * This file is part of the TelegramBot package.
4
 *
5
 * (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Longman\TelegramBot\Entities\Payments;
12
13
use Longman\TelegramBot\Entities\Entity;
14
use Longman\TelegramBot\Entities\User;
15
use Longman\TelegramBot\Request;
16
17
/**
18
 * Class ShippingQuery
19
 *
20
 * This object contains information about an incoming shipping query.
21
 *
22
 * @link https://core.telegram.org/bots/api#shippingquery
23
 *
24
 * @method string          getId()              Unique query identifier
25
 * @method User            getFrom()            User who sent the query
26
 * @method string          getInvoicePayload()  Bot specified invoice payload
27
 * @method ShippingAddress getShippingAddress() User specified shipping address
28
 **/
29
class ShippingQuery extends Entity
30
{
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function subEntities()
35
    {
36
        return [
37
            'user'             => User::class,
38
            'shipping_address' => ShippingAddress::class,
39
        ];
40
    }
41
42
    /**
43
     * Answer this shipping query.
44
     *
45
     * @param bool  $ok
46
     * @param array $data
47
     *
48
     * @return \Longman\TelegramBot\Entities\ServerResponse
49
     */
50
    public function answer($ok, array $data = [])
51
    {
52
        return Request::answerShippingQuery(array_merge([
53
            'shipping_query_id' => $this->getId(),
54
            'ok'                => $ok,
55
        ], $data));
56
    }
57
}
58