PayloadButton   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Test Coverage

Coverage 72.72%

Importance

Changes 0
Metric Value
wmc 4
eloc 8
dl 0
loc 47
c 0
b 0
f 0
ccs 8
cts 11
cp 0.7272
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setPayload() 0 5 1
A make() 0 3 1
A __construct() 0 5 1
A getPayload() 0 3 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, array $parameters = [])
12
    {
13 1
        parent::__construct($label, $parameters);
14
15 1
        $this->payload = $payload;
16 1
    }
17
18
    /**
19
     * Make a new payload button instance.
20
     *
21
     * @param string $label
22
     * @param mixed  $payload
23
     * @param array  $parameters
24
     *
25
     * @return static
26
     */
27 1
    public static function make(string $label, $payload, array $parameters = [])
28
    {
29 1
        return new static($label, $payload, $parameters);
30
    }
31
32
    /**
33
     * Get payload.
34
     *
35
     * @return mixed
36
     */
37 1
    public function getPayload()
38
    {
39 1
        return $this->payload;
40
    }
41
42
    /**
43
     * Set payload.
44
     *
45
     * @param mixed $payload
46
     *
47
     * @return PayloadButton
48
     */
49
    public function setPayload($payload): PayloadButton
50
    {
51
        $this->payload = $payload;
52
53
        return $this;
54
    }
55
}
56