Passed
Push — master ( 8ed01e...08cfff )
by Romain
02:40
created

AccountLink   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 35
ccs 9
cts 9
cp 1
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
3
namespace Kerox\Messenger\Model\Common\Button;
4
5
class AccountLink extends AbstractButton
6
{
7
8
    /**
9
     * @var string
10
     */
11
    protected $url;
12
13
    /**
14
     * AccountLink constructor.
15
     *
16
     * @param string $url
17
     */
18 1
    public function __construct(string $url)
19
    {
20 1
        parent::__construct(self::TYPE_ACCOUNT_LINK);
21
22 1
        $this->isValidUrl($url);
23
24 1
        $this->url = $url;
25 1
    }
26
27
    /**
28
     * @return array
29
     */
30 1
    public function jsonSerialize(): array
31
    {
32 1
        $json = parent::jsonSerialize();
33
        $json += [
34 1
            'url' => $this->url,
35
        ];
36
37 1
        return $json;
38
    }
39
}
40