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

DeleteMethodTrait::deleteStickerFromSet()   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\DeleteChatPhotoMethod;
10
use TgBotApi\BotApiBase\Method\DeleteChatStickerSetMethod;
11
use TgBotApi\BotApiBase\Method\DeleteMessageMethod;
12
use TgBotApi\BotApiBase\Method\DeleteStickerFromSetMethod;
13
use TgBotApi\BotApiBase\Method\DeleteWebhookMethod;
14
15
/**
16
 * Trait DeleteMethodTrait.
17
 */
18
trait DeleteMethodTrait
19
{
20
    /**
21
     * @param $method
22
     * @param $type
23
     *
24
     * @throws ResponseException
25
     * @throws NormalizationException
26
     *
27
     * @return mixed
28
     */
29
    abstract public function call($method, $type = null);
30
31
    /**
32
     * @param DeleteChatPhotoMethod $method
33
     *
34
     * @throws NormalizationException
35
     * @throws ResponseException
36
     *
37
     * @return bool
38
     */
39 3
    public function deleteChatPhoto(DeleteChatPhotoMethod $method): bool
40
    {
41 3
        return $this->call($method);
42
    }
43
44
    /**
45
     * @param DeleteChatStickerSetMethod $method
46
     *
47
     * @throws NormalizationException
48
     * @throws ResponseException
49
     *
50
     * @return bool
51
     */
52 3
    public function deleteChatStickerSet(DeleteChatStickerSetMethod $method): bool
53
    {
54 3
        return $this->call($method);
55
    }
56
57
    /**
58
     * @param DeleteMessageMethod $method
59
     *
60
     * @throws NormalizationException
61
     * @throws ResponseException
62
     *
63
     * @return bool
64
     */
65 3
    public function deleteMessage(DeleteMessageMethod $method): bool
66
    {
67 3
        return $this->call($method);
68
    }
69
70
    /**
71
     * @param DeleteStickerFromSetMethod $method
72
     *
73
     * @throws NormalizationException
74
     * @throws ResponseException
75
     *
76
     * @return bool
77
     */
78 3
    public function deleteStickerFromSet(DeleteStickerFromSetMethod $method): bool
79
    {
80 3
        return $this->call($method);
81
    }
82
83
    /**
84
     * @param DeleteWebhookMethod $method
85
     *
86
     * @throws NormalizationException
87
     * @throws ResponseException
88
     *
89
     * @return bool
90
     */
91 3
    public function deleteWebhook(DeleteWebhookMethod $method): bool
92
    {
93 3
        return $this->call($method);
94
    }
95
}
96