InputInlineQueryResultPhoto   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 147
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 51
dl 0
loc 147
rs 10
c 0
b 0
f 0
wmc 12

12 Methods

Rating   Name   Duplication   Size   Complexity  
A getReplyMarkup() 0 3 1
A getDescription() 0 3 1
A getThumbnailUrl() 0 3 1
A getInputMessageContent() 0 3 1
A fromArray() 0 12 1
A __construct() 0 22 1
A getTitle() 0 3 1
A typeSerialize() 0 13 1
A getId() 0 3 1
A getPhotoUrl() 0 3 1
A getPhotoWidth() 0 3 1
A getPhotoHeight() 0 3 1
1
<?php
2
3
/**
4
 * This phpFile is auto-generated.
5
 */
6
7
declare(strict_types=1);
8
9
namespace PHPTdGram\Schema;
10
11
/**
12
 * Represents link to a JPEG image.
13
 */
14
class InputInlineQueryResultPhoto extends InputInlineQueryResult
15
{
16
    public const TYPE_NAME = 'inputInlineQueryResultPhoto';
17
18
    /**
19
     * Unique identifier of the query result.
20
     */
21
    protected string $id;
22
23
    /**
24
     * Title of the result, if known.
25
     */
26
    protected string $title;
27
28
    /**
29
     * A short description of the result, if known.
30
     */
31
    protected string $description;
32
33
    /**
34
     * URL of the photo thumbnail, if it exists.
35
     */
36
    protected string $thumbnailUrl;
37
38
    /**
39
     * The URL of the JPEG photo (photo size must not exceed 5MB).
40
     */
41
    protected string $photoUrl;
42
43
    /**
44
     * Width of the photo.
45
     */
46
    protected int $photoWidth;
47
48
    /**
49
     * Height of the photo.
50
     */
51
    protected int $photoHeight;
52
53
    /**
54
     * The message reply markup. Must be of type replyMarkupInlineKeyboard or null.
55
     */
56
    protected ReplyMarkup $replyMarkup;
57
58
    /**
59
     * The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessagePhoto, InputMessageLocation, InputMessageVenue or InputMessageContact.
60
     */
61
    protected InputMessageContent $inputMessageContent;
62
63
    public function __construct(
64
        string $id,
65
        string $title,
66
        string $description,
67
        string $thumbnailUrl,
68
        string $photoUrl,
69
        int $photoWidth,
70
        int $photoHeight,
71
        ReplyMarkup $replyMarkup,
72
        InputMessageContent $inputMessageContent
73
    ) {
74
        parent::__construct();
75
76
        $this->id                  = $id;
77
        $this->title               = $title;
78
        $this->description         = $description;
79
        $this->thumbnailUrl        = $thumbnailUrl;
80
        $this->photoUrl            = $photoUrl;
81
        $this->photoWidth          = $photoWidth;
82
        $this->photoHeight         = $photoHeight;
83
        $this->replyMarkup         = $replyMarkup;
84
        $this->inputMessageContent = $inputMessageContent;
85
    }
86
87
    public static function fromArray(array $array): InputInlineQueryResultPhoto
88
    {
89
        return new static(
90
            $array['id'],
91
            $array['title'],
92
            $array['description'],
93
            $array['thumbnail_url'],
94
            $array['photo_url'],
95
            $array['photo_width'],
96
            $array['photo_height'],
97
            TdSchemaRegistry::fromArray($array['reply_markup']),
98
            TdSchemaRegistry::fromArray($array['input_message_content']),
99
        );
100
    }
101
102
    public function typeSerialize(): array
103
    {
104
        return [
105
            '@type'                 => static::TYPE_NAME,
106
            'id'                    => $this->id,
107
            'title'                 => $this->title,
108
            'description'           => $this->description,
109
            'thumbnail_url'         => $this->thumbnailUrl,
110
            'photo_url'             => $this->photoUrl,
111
            'photo_width'           => $this->photoWidth,
112
            'photo_height'          => $this->photoHeight,
113
            'reply_markup'          => $this->replyMarkup->typeSerialize(),
114
            'input_message_content' => $this->inputMessageContent->typeSerialize(),
115
        ];
116
    }
117
118
    public function getId(): string
119
    {
120
        return $this->id;
121
    }
122
123
    public function getTitle(): string
124
    {
125
        return $this->title;
126
    }
127
128
    public function getDescription(): string
129
    {
130
        return $this->description;
131
    }
132
133
    public function getThumbnailUrl(): string
134
    {
135
        return $this->thumbnailUrl;
136
    }
137
138
    public function getPhotoUrl(): string
139
    {
140
        return $this->photoUrl;
141
    }
142
143
    public function getPhotoWidth(): int
144
    {
145
        return $this->photoWidth;
146
    }
147
148
    public function getPhotoHeight(): int
149
    {
150
        return $this->photoHeight;
151
    }
152
153
    public function getReplyMarkup(): ReplyMarkup
154
    {
155
        return $this->replyMarkup;
156
    }
157
158
    public function getInputMessageContent(): InputMessageContent
159
    {
160
        return $this->inputMessageContent;
161
    }
162
}
163