KeyboardButtonPollType::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
dl 0
loc 6
c 1
b 0
f 0
ccs 0
cts 5
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace TgBotApi\BotApiBase\Type\Poll;
6
7
use TgBotApi\BotApiBase\Interfaces\PollTypeInterface;
8
9
/**
10
 * This object represents type of a poll,
11
 * which is allowed to be created and sent when the corresponding button is pressed.
12
 *
13
 * @see https://core.telegram.org/bots/api#keyboardbuttonpolltype
14
 */
15
class KeyboardButtonPollType implements PollTypeInterface
16
{
17
    /**
18
     * Optional. If quiz is passed, the user will be allowed to create only polls in the quiz mode.
19
     * If regular is passed, only regular polls will be allowed.
20
     * Otherwise, the user will be allowed to create a poll of any type.
21
     *
22
     * @var string
23
     */
24
    public $type;
25
26
    public static function create(string $type): KeyboardButtonPollType
27
    {
28
        $instance = new static();
29
        $instance->type = $type;
30
31
        return $instance;
32
    }
33
}
34