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

SetMethodTrait::setWebhook()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
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\SetChatDescriptionMethod;
10
use TgBotApi\BotApiBase\Method\SetChatPhotoMethod;
11
use TgBotApi\BotApiBase\Method\SetChatStickerSetMethod;
12
use TgBotApi\BotApiBase\Method\SetChatTitleMethod;
13
use TgBotApi\BotApiBase\Method\SetGameScoreMethod;
14
use TgBotApi\BotApiBase\Method\SetPassportDataErrorsMethod;
15
use TgBotApi\BotApiBase\Method\SetStickerPositionInSetMethod;
16
use TgBotApi\BotApiBase\Method\SetWebhookMethod;
17
18
/**
19
 * Trait SetMethodTrait.
20
 */
21
trait SetMethodTrait
22
{
23
    /**
24
     * @param $method
25
     * @param $type
26
     *
27
     * @throws ResponseException
28
     * @throws NormalizationException
29
     *
30
     * @return mixed
31
     */
32
    abstract public function call($method, $type = null);
33
34
    /**
35
     * @param SetChatDescriptionMethod $method
36
     *
37
     * @throws ResponseException
38
     * @throws NormalizationException
39
     *
40
     * @return bool
41
     */
42 3
    public function setChatDescription(SetChatDescriptionMethod $method): bool
43
    {
44 3
        return $this->call($method);
45
    }
46
47
    /**
48
     * @param SetChatPhotoMethod $method
49
     *
50
     * @throws ResponseException
51
     * @throws NormalizationException
52
     *
53
     * @return bool
54
     */
55 3
    public function setChatPhoto(SetChatPhotoMethod $method): bool
56
    {
57 3
        return $this->call($method);
58
    }
59
60
    /**
61
     * @param SetChatStickerSetMethod $method
62
     *
63
     * @throws ResponseException
64
     * @throws NormalizationException
65
     *
66
     * @return bool
67
     */
68 3
    public function setChatStickerSet(SetChatStickerSetMethod $method): bool
69
    {
70 3
        return $this->call($method);
71
    }
72
73
    /**
74
     * @param SetChatTitleMethod $method
75
     *
76
     * @throws ResponseException
77
     * @throws NormalizationException
78
     *
79
     * @return bool
80
     */
81 3
    public function setChatTitle(SetChatTitleMethod $method): bool
82
    {
83 3
        return $this->call($method);
84
    }
85
86
    /**
87
     * @param SetGameScoreMethod $method
88
     *
89
     * @throws ResponseException
90
     * @throws NormalizationException
91
     *
92
     * @return bool
93
     */
94 6
    public function setGameScore(SetGameScoreMethod $method): bool
95
    {
96 6
        return $this->call($method);
97
    }
98
99
    /**
100
     * @param SetStickerPositionInSetMethod $method
101
     *
102
     * @throws ResponseException
103
     * @throws NormalizationException
104
     *
105
     * @return bool
106
     */
107 3
    public function setStickerPositionInSet(SetStickerPositionInSetMethod $method): bool
108
    {
109 3
        return $this->call($method);
110
    }
111
112
    /**
113
     * @param SetWebhookMethod $method
114
     *
115
     * @throws ResponseException
116
     * @throws NormalizationException
117
     *
118
     * @return bool
119
     */
120 3
    public function setWebhook(SetWebhookMethod $method): bool
121
    {
122 3
        return $this->call($method);
123
    }
124
125
    /**
126
     * @param SetPassportDataErrorsMethod $method
127
     *
128
     * @throws NormalizationException
129
     * @throws ResponseException
130
     *
131
     * @return bool
132
     */
133 27
    public function setPassportDataErrors(SetPassportDataErrorsMethod $method): bool
134
    {
135 27
        return $this->call($method);
136
    }
137
}
138