Completed
Push — master ( 3347ae...8ec7fe )
by Romain
9s
created

PhoneNumber   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 44
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A jsonSerialize() 0 10 1
1
<?php
2
namespace Kerox\Messenger\Model\Common\Buttons;
3
4
class PhoneNumber extends AbstractButtons
5
{
6
7
    /**
8
     * @var string
9
     */
10
    protected $title;
11
12
    /**
13
     * @var string
14
     */
15
    protected $payload;
16
17
    /**
18
     * PhoneNumber constructor.
19
     *
20
     * @param string $title
21
     * @param string $payload
22
     */
23
    public function __construct(string $title, string $payload)
24
    {
25
        parent::__construct(self::TYPE_PHONE_NUMBER);
26
27
        $this->isValidString($title, 20);
28
        $this->isValidString($payload, 1000);
29
30
        $this->title = $title;
31
        $this->payload = $payload;
32
    }
33
34
    /**
35
     * @return array
36
     */
37
    public function jsonSerialize(): array
38
    {
39
        $json = parent::jsonSerialize();
40
        $json += [
41
            'title' => $this->title,
42
            'payload' => $this->payload,
43
        ];
44
45
        return $json;
46
    }
47
}
48