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

AccountLink   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

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