Completed
Push — master ( 695e63...f2fe6e )
by Armando
02:21 queued 01:02
created

Poll   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 27
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A subEntities() 0 6 1
A getOptions() 0 6 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;
12
13
/**
14
 * Class Poll
15
 *
16
 * This entity contains information about a poll.
17
 *
18
 * @link https://core.telegram.org/bots/api#poll
19
 *
20
 * @method string getId()       Unique poll identifier
21
 * @method string getQuestion() Poll question, 1-255 characters
22
 * @method bool   getIsClosed() True, if the poll is closed
23
 */
24
class Poll extends Entity
25
{
26
    /**
27
     * {@inheritdoc}
28
     */
29
    protected function subEntities()
30
    {
31
        return [
32
            'options' => PollOption::class,
33
        ];
34
    }
35
36
    /**
37
     * List of poll options
38
     *
39
     * This method overrides the default getOptions method
40
     * and returns a nice array of PollOption objects.
41
     *
42
     * @return null|PollOption[]
43
     */
44
    public function getOptions()
45
    {
46
        $pretty_array = $this->makePrettyObjectArray(PollOption::class, 'options');
47
48
        return empty($pretty_array) ? null : $pretty_array;
49
    }
50
}
51