Completed
Push — master ( ed5034...64bcd9 )
by Armando
02:01
created

Game::subEntities()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * This file is part of the TelegramBot package.
4
 *
5
 * (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Longman\TelegramBot\Entities\Games;
12
13
use Longman\TelegramBot\Entities\Entity;
14
use Longman\TelegramBot\Entities\MessageEntity;
15
16
/**
17
 * Class Game
18
 *
19
 * This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
20
 *
21
 * @link https://core.telegram.org/bots/api#game
22
 *
23
 * @method string    getTitle()        Title of the game
24
 * @method string    getDescription()  Description of the game
25
 * @method string    getText()         Optional. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters.
26
 * @method Animation getAnimation()    Optional. Animation that will be displayed in the game message in chats. Upload via BotFather
27
 **/
28
class Game extends Entity
29
{
30
    /**
31
     * {@inheritdoc}
32
     */
33
    protected function subEntities()
34
    {
35
        return [
36
            'photo'         => PhotoSize::class,
37
            'text_entities' => MessageEntity::class,
38
            'animation'     => Animation::class,
39
        ];
40
    }
41
42
    /**
43
     * Photo that will be displayed in the game message in chats.
44
     *
45
     * This method overrides the default getPhoto method
46
     * and returns a nice array of PhotoSize objects.
47
     *
48
     * @return null|PhotoSize[]
49
     */
50
    public function getPhoto()
51
    {
52
        $pretty_array = $this->makePrettyObjectArray(PhotoSize::class, 'photo');
53
54
        return empty($pretty_array) ? null : $pretty_array;
55
    }
56
57
    /**
58
     * Optional. Special entities that appear in text, such as usernames, URLs, bot commands, etc.
59
     *
60
     * This method overrides the default getTextEntities method
61
     * and returns a nice array of MessageEntity objects.
62
     *
63
     * @return null|MessageEntity[]
64
     */
65
    public function getTextEntities()
66
    {
67
        $pretty_array = $this->makePrettyObjectArray(MessageEntity::class, 'text_entities');
68
69
        return empty($pretty_array) ? null : $pretty_array;
70
    }
71
}
72