Test Failed
Push — master ( ad5f1c...9bfc37 )
by Dominik
02:03
created

Link   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 61
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getHref() 0 4 1
A isTemplated() 0 4 1
A getRels() 0 4 1
A getAttributes() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\Serialization\Link;
6
7
use Psr\Link\LinkInterface;
8
9
final class Link implements LinkInterface
10
{
11
    /**
12
     * @var string
13
     */
14
    private $href;
15
16
    /**
17
     * @var string[]
18
     */
19
    private $rels;
20
21
    /**
22
     * @var array
23
     */
24
    private $attributes;
25
26
    /**
27
     * @param string   $href
28
     * @param string[] $rels
29
     * @param array    $attributes
30
     */
31 2
    public function __construct(string $href, array $rels, array $attributes)
32
    {
33 2
        $this->href = $href;
34 2
        $this->rels = $rels;
35 2
        $this->attributes = $attributes;
36 2
    }
37
38
    /**
39
     * @return string
40
     */
41 2
    public function getHref(): string
42
    {
43 2
        return $this->href;
44
    }
45
46
    /**
47
     * @return bool
48
     */
49 2
    public function isTemplated(): bool
50
    {
51 2
        return false !== strpos($this->href, '{');
52
    }
53
54
    /**
55
     * @return string[]
56
     */
57 2
    public function getRels(): array
58
    {
59 2
        return $this->rels;
60
    }
61
62
    /**
63
     * @return array
64
     */
65 2
    public function getAttributes(): array
66
    {
67 2
        return $this->attributes;
68
    }
69
}
70