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

PayloadButton   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 72.72%

Importance

Changes 0
Metric Value
dl 0
loc 48
ccs 8
cts 11
cp 0.7272
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A create() 0 4 1
A getPayload() 0 4 1
A setPayload() 0 6 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