Keyboard   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 7
eloc 13
dl 0
loc 57
c 0
b 0
f 0
ccs 12
cts 18
cp 0.6667
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getButtons() 0 3 1
A setParameters() 0 5 1
A __construct() 0 4 1
A getName() 0 3 1
A addButton() 0 5 1
A getParameters() 0 3 1
A make() 0 3 1
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