Completed
Push — master ( 588078...30ae0c )
by Nikolay
04:51 queued 02:15
created

InlineQueryResultPhotoType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 89
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 17
dl 0
loc 89
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Greenplugin\TelegramBot\Type\InlineQueryResult;
6
7
use Greenplugin\TelegramBot\Method\Interfaces\HasParseModeVariableInterface;
8
use Greenplugin\TelegramBot\Method\Traits\FillFromArrayTrait;
9
use Greenplugin\TelegramBot\Type\InputMessageContent\InputMessageContentType;
10
11
/**
12
 * Class InlineQueryResultPhotoType.
13
 *
14
 * @see https://core.telegram.org/bots/api#inlinequeryresultphoto
15
 */
16
class InlineQueryResultPhotoType extends InlineQueryResultType implements HasParseModeVariableInterface
17
{
18
    use FillFromArrayTrait;
19
    /**
20
     * A valid URL of the photo. Photo must be in jpeg format. Photo size must not exceed 5MB.
21
     *
22
     * @var string
23
     */
24
    public $photoUrl;
25
26
    /**
27
     * URL of the thumbnail for the photo.
28
     *
29
     * @var string
30
     */
31
    public $thumbUrl;
32
33
    /**
34
     * Optional. Width of the photo.
35
     *
36
     * @var int|null
37
     */
38
    public $photoWidth;
39
40
    /**
41
     * Optional. Height of the photo.
42
     *
43
     * @var int|null
44
     */
45
    public $photoHeight;
46
47
    /**
48
     * Optional. Title for the result.
49
     *
50
     * @var string|null
51
     */
52
    public $title;
53
54
    /**
55
     * Optional. Short description of the result.
56
     *
57
     * @var string|null
58
     */
59
    public $description;
60
61
    /**
62
     * Optional. Caption of the photo to be sent, 0-1024 characters.
63
     *
64
     * @var string|null
65
     */
66
    public $caption;
67
68
    /**
69
     * Optional. Send Markdown or HTML, if you want Telegram apps to show bold, italic,
70
     * fixed-width text or inline URLs in the media caption.
71
     *
72
     * @var string|null
73
     */
74
    public $parseMode;
75
76
    /**
77
     * Optional. Content of the message to be sent instead of the photo.
78
     *
79
     * @var InputMessageContentType|null
80
     */
81
    public $inputMessageContent;
82
83
    /**
84
     * InlineQueryResultArticleType constructor.
85
     *
86
     * @param string     $id
87
     * @param string     $thumbUrl
88
     * @param string     $photoUrl
89
     * @param array|null $data
90
     *
91
     * @throws \Greenplugin\TelegramBot\Exception\BadArgumentException
92
     */
93
    public function __construct(
94
        string $id,
95
        string $photoUrl,
96
        string $thumbUrl,
97
        array $data = null
98
    ) {
99
        $this->type = self::TYPE_PHOTO;
100
        $this->id = $id;
101
        $this->photoUrl = $photoUrl;
102
        $this->thumbUrl = $thumbUrl;
103
        if ($data) {
104
            $this->fill($data);
105
        }
106
    }
107
}
108