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

AccountLink::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
crap 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