Completed
Push — master ( fafbf7...a6c735 )
by Vladimir
04:01
created

Keyboard::make()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Templates;
6
7
use FondBot\Contracts\Template;
8
use Illuminate\Support\Collection;
9
use FondBot\Templates\Keyboard\Button;
10
11
class Keyboard implements Template
12
{
13
    /** @var Button[] */
14
    private $buttons;
15
    private $parameters;
16
17
    /**
18
     * @param Button[] $buttons
19
     * @param array    $parameters
20
     */
21 3
    public function __construct(array $buttons = [], array $parameters = [])
22
    {
23 3
        $this->buttons = $buttons;
24 3
        $this->parameters = collect($parameters);
25 3
    }
26
27
    /**
28
     * @param Button[] $buttons
29
     * @param array    $parameters
30
     *
31
     * @return static
32
     */
33 3
    public static function make(array $buttons = [], array $parameters = [])
34
    {
35 3
        return new static($buttons, $parameters);
36
    }
37
38 2
    public function getName(): string
39
    {
40 2
        return 'Keyboard';
41
    }
42
43
    /**
44
     * @return Button[]
45
     */
46 1
    public function getButtons(): array
47
    {
48 1
        return $this->buttons;
49
    }
50
51
    public function addButton(Button $button): Keyboard
52
    {
53
        $this->buttons[] = $button;
54
55
        return $this;
56
    }
57
58 1
    public function getParameters(): Collection
59
    {
60 1
        return $this->parameters;
61
    }
62
63
    public function setParameters(array $parameters): Keyboard
64
    {
65
        $this->parameters = $parameters;
66
67
        return $this;
68
    }
69
}
70