Passed
Push — master ( 94d770...d9484a )
by Armando
02:57
created

ChatPermissions::getCanSendMediaMessages()   A

Complexity

Conditions 6
Paths 6

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 42

Importance

Changes 0
Metric Value
cc 6
eloc 6
c 0
b 0
f 0
nc 6
nop 0
dl 0
loc 8
ccs 0
cts 7
cp 0
crap 42
rs 9.2222
1
<?php
2
3
/**
4
 * This file is part of the TelegramBot package.
5
 *
6
 * (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Longman\TelegramBot\Entities;
13
14
/**
15
 * Class ChatPermissions
16
 *
17
 * @link https://core.telegram.org/bots/api#chatpermissions
18
 *
19
 * @method bool getCanSendMessages()       Optional. True, if the user is allowed to send text messages, contacts, locations and venues
20
 * @method bool getCanSendAudios()         Optional. True, if the user is allowed to send audios
21
 * @method bool getCanSendDocuments()      Optional. True, if the user is allowed to send documents
22
 * @method bool getCanSendPhotos()         Optional. True, if the user is allowed to send photos
23
 * @method bool getCanSendVideos()         Optional. True, if the user is allowed to send videos
24
 * @method bool getCanSendVideoNotes()     Optional. True, if the user is allowed to send video notes
25
 * @method bool getCanSendVoiceNotes()     Optional. True, if the user is allowed to send voice notes
26
 * @method bool getCanSendPolls()          Optional. True, if the user is allowed to send polls, implies can_send_messages
27
 * @method bool getCanSendOtherMessages()  Optional. True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages
28
 * @method bool getCanAddWebPagePreviews() Optional. True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages
29
 * @method bool getCanChangeInfo()         Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups
30
 * @method bool getCanInviteUsers()        Optional. True, if the user is allowed to invite new users to the chat
31
 * @method bool getCanPinMessages()        Optional. True, if the user is allowed to pin messages. Ignored in public supergroups
32
 * @method bool getCanManageTopics()       Optional. True, if the user is allowed to create forum topics. If omitted defaults to the value of can_pin_messages
33
 */
34
class ChatPermissions extends Entity
35
{
36
    /**
37
     * True, if the user is allowed to send audios, documents, photos, videos, video notes OR voice notes
38
     *
39
     * @deprecated Use new fine-grained methods provided by Telegram Bot API.
40
     *
41
     * @return bool
42
     */
43
    public function getCanSendMediaMessages(): bool
44
    {
45
        return $this->getCanSendAudios() ||
46
            $this->getCanSendDocuments() ||
47
            $this->getCanSendPhotos() ||
48
            $this->getCanSendVideos() ||
49
            $this->getCanSendVideoNotes() ||
50
            $this->getCanSendVoiceNotes();
51
    }
52
}
53