Completed
Pull Request — master (#53)
by Romain
03:15
created

AccountLink::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 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
    public function __construct(string $url)
19
    {
20
        parent::__construct(self::TYPE_ACCOUNT_LINK);
21
22
        $this->isValidUrl($url);
23
24
        $this->url = $url;
25
    }
26
27
    /**
28
     * @return array
29
     */
30
    public function jsonSerialize(): array
31
    {
32
        $json = parent::jsonSerialize();
33
        $json += [
34
            'url' => $this->url,
35
        ];
36
37
        return $json;
38
    }
39
}
40