Passed
Push — master ( 45bce2...5a8248 )
by Nikolay
03:20
created

AnswerMethodTrait::answerPreCheckoutQuery()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Helper;
6
7
use TgBotApi\BotApiBase\Exception\NormalizationException;
8
use TgBotApi\BotApiBase\Exception\ResponseException;
9
use TgBotApi\BotApiBase\Method\AnswerCallbackQueryMethod;
10
use TgBotApi\BotApiBase\Method\AnswerInlineQueryMethod;
11
use TgBotApi\BotApiBase\Method\AnswerShippingQueryMethod;
12
13
/**
14
 * Trait AnswerMethodTrait.
15
 */
16
trait AnswerMethodTrait
17
{
18
    /**
19
     * @param $method
20
     * @param $type
21
     *
22
     * @throws ResponseException
23
     * @throws NormalizationException
24
     *
25
     * @return mixed
26
     */
27
    abstract public function call($method, $type = null);
28
29
    /**
30
     * @param AnswerCallbackQueryMethod $method
31
     *
32
     * @throws ResponseException
33
     * @throws NormalizationException
34
     *
35
     * @return bool
36
     */
37 9
    public function answerCallbackQuery(AnswerCallbackQueryMethod $method): bool
38
    {
39 9
        return $this->call($method);
40
    }
41
42
    /**
43
     * @param AnswerInlineQueryMethod $method
44
     *
45
     * @throws ResponseException
46
     * @throws NormalizationException
47
     *
48
     * @return bool
49
     */
50 6
    public function answerInlineQuery(AnswerInlineQueryMethod $method): bool
51
    {
52 6
        return $this->call($method);
53
    }
54
55
    /**
56
     * @param AnswerInlineQueryMethod $method
57
     *
58
     * @throws NormalizationException
59
     * @throws ResponseException
60
     *
61
     * @return bool
62
     */
63
    public function answerPreCheckoutQuery(AnswerInlineQueryMethod $method): bool
64
    {
65
        return $this->call($method);
66
    }
67
68
    /**
69
     * @param AnswerShippingQueryMethod $method
70
     *
71
     * @throws NormalizationException
72
     * @throws ResponseException
73
     *
74
     * @return bool
75
     */
76
    public function answerShippingQuery(AnswerShippingQueryMethod $method): bool
77
    {
78
        return $this->call($method);
79
    }
80
}
81