AccountLink   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 41
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A create() 0 4 1
A toArray() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Kerox\Messenger\Model\Common\Button;
6
7
class AccountLink extends AbstractButton
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $url;
13
14
    /**
15
     * AccountLink constructor.
16
     *
17
     * @throws \Kerox\Messenger\Exception\MessengerException
18
     */
19 1
    public function __construct(string $url)
20
    {
21 1
        parent::__construct(self::TYPE_ACCOUNT_LINK);
22
23 1
        $this->isValidUrl($url);
24
25 1
        $this->url = $url;
26 1
    }
27
28
    /**
29
     * @throws \Kerox\Messenger\Exception\MessengerException
30
     *
31
     * @return \Kerox\Messenger\Model\Common\Button\AccountLink
32
     */
33 1
    public static function create(string $url): self
34
    {
35 1
        return new self($url);
36
    }
37
38 1
    public function toArray(): array
39
    {
40 1
        $array = parent::toArray();
41
        $array += [
42 1
            'url' => $this->url,
43
        ];
44
45 1
        return $array;
46
    }
47
}
48