Completed
Push — master ( 457641...4299bc )
by Vladimir
03:29
created

Button::setParameters()   A

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 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
ccs 0
cts 3
cp 0
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Templates\Keyboard;
6
7
use FondBot\Contracts\Template;
8
9
abstract class Button implements Template
10
{
11
    protected $label;
12
    protected $parameters;
13
14 3
    public function __construct(string $label, array $parameters = [])
15
    {
16 3
        $this->label = $label;
17 3
        $this->parameters = $parameters;
18 3
    }
19
20
    /**
21
     * Get name.
22
     *
23
     * @return string
24
     */
25 3
    public function getName(): string
26
    {
27 3
        return class_basename($this);
28
    }
29
30
    /**
31
     * Get label.
32
     *
33
     * @return string
34
     */
35 3
    public function getLabel(): ?string
36
    {
37 3
        return $this->label;
38
    }
39
40
    /**
41
     * Set label.
42
     *
43
     * @param string $label
44
     *
45
     * @return static
46
     */
47
    public function setLabel(string $label): Button
48
    {
49
        $this->label = $label;
50
51
        return $this;
52
    }
53
54
    /**
55
     * Get button parameters.
56
     *
57
     * @return array
58
     */
59 1
    public function getParameters(): array
60
    {
61 1
        return $this->parameters;
62
    }
63
64
    /**
65
     * Set parameters.
66
     *
67
     * @param array $parameters
68
     *
69
     * @return static
70
     */
71
    public function setParameters(array $parameters): Button
72
    {
73
        $this->parameters = $parameters;
74
75
        return $this;
76
    }
77
}
78