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

EditMethodTrait::editMessageText()   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\EditMessageCaptionMethod;
10
use TgBotApi\BotApiBase\Method\EditMessageLiveLocationMethod;
11
use TgBotApi\BotApiBase\Method\EditMessageMediaMethod;
12
use TgBotApi\BotApiBase\Method\EditMessageReplyMarkupMethod;
13
use TgBotApi\BotApiBase\Method\EditMessageTextMethod;
14
15
/**
16
 * Trait EditMethodTrait.
17
 */
18
trait EditMethodTrait
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 EditMessageCaptionMethod $method
33
     *
34
     * @throws NormalizationException
35
     * @throws ResponseException
36
     *
37
     * @return bool
38
     */
39
    public function editMessageCaption(EditMessageCaptionMethod $method): bool
40
    {
41
        return $this->call($method);
42
    }
43
44
    /**
45
     * @param EditMessageLiveLocationMethod $method
46
     *
47
     * @throws NormalizationException
48
     * @throws ResponseException
49
     *
50
     * @return bool
51
     */
52
    public function editMessageLiveLocation(EditMessageLiveLocationMethod $method): bool
53
    {
54
        return $this->call($method);
55
    }
56
57
    /**
58
     * @param EditMessageMediaMethod $method
59
     *
60
     * @throws NormalizationException
61
     * @throws ResponseException
62
     *
63
     * @return bool
64
     */
65
    public function editMessageMedia(EditMessageMediaMethod $method): bool
66
    {
67
        return $this->call($method);
68
    }
69
70
    /**
71
     * @param EditMessageReplyMarkupMethod $method
72
     *
73
     * @throws NormalizationException
74
     * @throws ResponseException
75
     *
76
     * @return bool
77
     */
78
    public function editMessageReplyMarkup(EditMessageReplyMarkupMethod $method): bool
79
    {
80
        return $this->call($method);
81
    }
82
83
    /**
84
     * @param EditMessageTextMethod $method
85
     *
86
     * @throws NormalizationException
87
     * @throws ResponseException
88
     *
89
     * @return bool
90
     */
91
    public function editMessageText(EditMessageTextMethod $method): bool
92
    {
93
        return $this->call($method);
94
    }
95
}
96