Completed
Push — master ( 8de31e...457641 )
by Vladimir
02:57
created

Button::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
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\Keyboard;
6
7
use FondBot\Contracts\Template;
8
9
abstract class Button implements Template
10
{
11
    protected $label;
12
13 3
    public function __construct(string $label)
14
    {
15 3
        $this->label = $label;
16 3
    }
17
18
    /**
19
     * Get name.
20
     *
21
     * @return string
22
     */
23 3
    public function getName(): string
24
    {
25 3
        return class_basename($this);
26
    }
27
28
    /**
29
     * Get label.
30
     *
31
     * @return string
32
     */
33 3
    public function getLabel(): ?string
34
    {
35 3
        return $this->label;
36
    }
37
38
    /**
39
     * Set label.
40
     *
41
     * @param string $label
42
     *
43
     * @return static
44
     */
45
    public function setLabel(string $label)
46
    {
47
        $this->label = $label;
48
49
        return $this;
50
    }
51
}
52