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

ForwardMethodTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
eloc 2
dl 0
loc 24
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A forwardMessage() 0 3 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\ForwardMessageMethod;
10
use TgBotApi\BotApiBase\Type\MessageType;
11
12
/**
13
 * Trait ForwardMethodTrait.
14
 */
15
trait ForwardMethodTrait
16
{
17
    /**
18
     * @param $method
19
     * @param $type
20
     *
21
     * @throws ResponseException
22
     * @throws NormalizationException
23
     *
24
     * @return mixed
25
     */
26
    abstract public function call($method, $type = null);
27
28
    /**
29
     * @param ForwardMessageMethod $method
30
     *
31
     * @throws NormalizationException
32
     * @throws ResponseException
33
     *
34
     * @return MessageType
35
     */
36 3
    public function forwardMessage(ForwardMessageMethod $method): MessageType
37
    {
38 3
        return $this->call($method, MessageType::class);
39
    }
40
}
41