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

PayloadButton::getPayload()   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
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FondBot\Templates\Keyboard;
6
7
class PayloadButton extends Button
8
{
9
    private $payload;
10
11 1
    public function __construct(string $label, $payload)
12
    {
13 1
        parent::__construct($label);
14
15 1
        $this->payload = $payload;
16 1
    }
17
18
    /**
19
     * Create a new payload button instance.
20
     *
21
     * @param string $label
22
     * @param $payload
23
     *
24
     * @return static
25
     */
26 1
    public static function create(string $label, $payload)
27
    {
28 1
        return new static($label, $payload);
29
    }
30
31
    /**
32
     * Get payload.
33
     *
34
     * @return mixed
35
     */
36 1
    public function getPayload()
37
    {
38 1
        return $this->payload;
39
    }
40
41
    /**
42
     * Set payload.
43
     *
44
     * @param mixed $payload
45
     *
46
     * @return PayloadButton
47
     */
48
    public function setPayload($payload): PayloadButton
49
    {
50
        $this->payload = $payload;
51
52
        return $this;
53
    }
54
}
55