Completed
Branch develop (8166a6)
by Romain
01:52
created

AbstractButtons   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 46
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getType() 0 4 1
A jsonSerialize() 0 6 1
1
<?php
2
namespace Kerox\Messenger\Model\Common\Buttons;
3
4
use Kerox\Messenger\ValidatorTrait;
5
6
abstract class AbstractButtons implements \JsonSerializable
7
{
8
9
    use ValidatorTrait;
10
11
    const TYPE_POSTBACK = 'postback';
12
    const TYPE_PHONE_NUMBER = 'phone_number';
13
    const TYPE_WEB_URL = 'web_url';
14
    const TYPE_SHARE = 'element_share';
15
    const TYPE_PAYMENT = 'payment';
16
    const TYPE_ACCOUNT_LINK = 'account_link';
17
    const TYPE_ACCOUNT_UNLINK = 'account_unlink';
18
19
    /**
20
     * @var string
21
     */
22
    private $type;
23
24
    /**
25
     * AbstractButton constructor.
26
     *
27
     * @param string $type
28
     */
29
    public function __construct(string $type)
30
    {
31
        $this->type = $type;
32
    }
33
34
    /**
35
     * @return string
36
     */
37
    public function getType(): string
38
    {
39
        return $this->type;
40
    }
41
42
    /**
43
     * @return array
44
     */
45
    public function jsonSerialize(): array
46
    {
47
        return [
48
            'type' => $this->type,
49
        ];
50
    }
51
}