UserTypeBot   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 96
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 31
dl 0
loc 96
rs 10
c 0
b 0
f 0
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A typeSerialize() 0 9 1
A __construct() 0 9 1
A getInlineQueryPlaceholder() 0 3 1
A getCanReadAllGroupMessages() 0 3 1
A getNeedLocation() 0 3 1
A getIsInline() 0 3 1
A fromArray() 0 8 1
A getCanJoinGroups() 0 3 1
1
<?php
2
3
/**
4
 * This phpFile is auto-generated.
5
 */
6
7
declare(strict_types=1);
8
9
namespace AurimasNiekis\TdLibSchema;
10
11
/**
12
 * A bot (see https://core.telegram.org/bots).
13
 */
14
class UserTypeBot extends UserType
15
{
16
    public const TYPE_NAME = 'userTypeBot';
17
18
    /**
19
     * True, if the bot can be invited to basic group and supergroup chats.
20
     *
21
     * @var bool
22
     */
23
    protected bool $canJoinGroups;
24
25
    /**
26
     * True, if the bot can read all messages in basic group or supergroup chats and not just those addressed to the bot. In private and channel chats a bot can always read all messages.
27
     *
28
     * @var bool
29
     */
30
    protected bool $canReadAllGroupMessages;
31
32
    /**
33
     * True, if the bot supports inline queries.
34
     *
35
     * @var bool
36
     */
37
    protected bool $isInline;
38
39
    /**
40
     * Placeholder for inline queries (displayed on the client input field).
41
     *
42
     * @var string
43
     */
44
    protected string $inlineQueryPlaceholder;
45
46
    /**
47
     * True, if the location of the user should be sent with every inline query to this bot.
48
     *
49
     * @var bool
50
     */
51
    protected bool $needLocation;
52
53
    public function __construct(bool $canJoinGroups, bool $canReadAllGroupMessages, bool $isInline, string $inlineQueryPlaceholder, bool $needLocation)
54
    {
55
        parent::__construct();
56
57
        $this->canJoinGroups           = $canJoinGroups;
58
        $this->canReadAllGroupMessages = $canReadAllGroupMessages;
59
        $this->isInline                = $isInline;
60
        $this->inlineQueryPlaceholder  = $inlineQueryPlaceholder;
61
        $this->needLocation            = $needLocation;
62
    }
63
64
    public static function fromArray(array $array): UserTypeBot
65
    {
66
        return new static(
67
            $array['can_join_groups'],
68
            $array['can_read_all_group_messages'],
69
            $array['is_inline'],
70
            $array['inline_query_placeholder'],
71
            $array['need_location'],
72
        );
73
    }
74
75
    public function typeSerialize(): array
76
    {
77
        return [
78
            '@type'                       => static::TYPE_NAME,
79
            'can_join_groups'             => $this->canJoinGroups,
80
            'can_read_all_group_messages' => $this->canReadAllGroupMessages,
81
            'is_inline'                   => $this->isInline,
82
            'inline_query_placeholder'    => $this->inlineQueryPlaceholder,
83
            'need_location'               => $this->needLocation,
84
        ];
85
    }
86
87
    public function getCanJoinGroups(): bool
88
    {
89
        return $this->canJoinGroups;
90
    }
91
92
    public function getCanReadAllGroupMessages(): bool
93
    {
94
        return $this->canReadAllGroupMessages;
95
    }
96
97
    public function getIsInline(): bool
98
    {
99
        return $this->isInline;
100
    }
101
102
    public function getInlineQueryPlaceholder(): string
103
    {
104
        return $this->inlineQueryPlaceholder;
105
    }
106
107
    public function getNeedLocation(): bool
108
    {
109
        return $this->needLocation;
110
    }
111
}
112