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

InlineQueryResultContactType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 16
dl 0
loc 78
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Greenplugin\TelegramBot\Type\InlineQueryResult;
6
7
use Greenplugin\TelegramBot\Method\Traits\FillFromArrayTrait;
8
use Greenplugin\TelegramBot\Type\InputMessageContent\InputMessageContentType;
9
10
/**
11
 * Class InlineQueryResultContactType.
12
 *
13
 * Represents a contact with a phone number. By default, this contact will be sent by the user.
14
 * Alternatively, you can use input_message_content to send a message with the specified content instead of the contact.
15
 *
16
 * @see https://core.telegram.org/bots/api#inlinequeryresultcontact
17
 */
18
class InlineQueryResultContactType extends InlineQueryResultType
19
{
20
    use FillFromArrayTrait;
21
22
    /**
23
     * Contact's phone number.
24
     *
25
     * @var string
26
     */
27
    public $phoneNumber;
28
29
    /**
30
     * Contact's first name.
31
     *
32
     * @var string
33
     */
34
    public $firstName;
35
36
    /**
37
     * Optional. Contact's last name.
38
     *
39
     * @var string|null
40
     */
41
    public $lastName;
42
43
    /**
44
     * Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes.
45
     *
46
     * @var string|null
47
     */
48
    public $vcard;
49
50
    /**
51
     * Optional. Content of the message to be sent instead of the contact.
52
     *
53
     * @var InputMessageContentType|null
54
     */
55
    public $inputMessageContent;
56
57
    /**
58
     * Optional. Url of the thumbnail for the result.
59
     *
60
     * @var string|null
61
     */
62
    public $thumbUrl;
63
64
    /**
65
     * Optional. Thumbnail width.
66
     *
67
     * @var int|null
68
     */
69
    public $thumbWidth;
70
71
    /**
72
     * Optional. Thumbnail height.
73
     *
74
     * @var int|null
75
     */
76
    public $thumbHeight;
77
78
    /**
79
     * InlineQueryResultContactType constructor.
80
     *
81
     * @param string     $id
82
     * @param string     $phoneNumber
83
     * @param string     $firstName
84
     * @param array|null $data
85
     *
86
     * @throws \Greenplugin\TelegramBot\Exception\BadArgumentException
87
     */
88
    public function __construct(string $id, string $phoneNumber, string $firstName, array $data = null)
89
    {
90
        $this->type = self::TYPE_CONTACT;
91
        $this->id = $id;
92
        $this->phoneNumber = $phoneNumber;
93
        $this->$firstName = $firstName;
94
        if ($data) {
95
            $this->fill($data);
96
        }
97
    }
98
}
99