Relation::getHref()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types = 1);
4
5
/*
6
 * This file is part of the FiveLab Resource package
7
 *
8
 * (c) FiveLab
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code
12
 */
13
14
namespace FiveLab\Component\Resource\Resource\Relation;
15
16
use FiveLab\Component\Resource\Resource\Href\HrefInterface;
17
18
/**
19
 * The default relation for resource.
20
 *
21
 * @author Vitaliy Zhuk <[email protected]>
22
 */
23
class Relation implements RelationInterface
24
{
25
    /**
26
     * @var string
27
     */
28
    private $name;
29
30
    /**
31
     * @var HrefInterface
32
     */
33
    private $href;
34
35
    /**
36
     * @var array
37
     */
38
    private $attributes;
39
40
    /**
41
     * Constructor.
42
     *
43
     * @param string        $name
44
     * @param HrefInterface $href
45
     * @param array         $attributes
46
     */
47 6
    public function __construct(string $name, HrefInterface $href, array $attributes = [])
48
    {
49 6
        $this->name = $name;
50 6
        $this->href = $href;
51 6
        $this->attributes = $attributes;
52 6
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57 2
    public function getName(): string
58
    {
59 2
        return $this->name;
60
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65 3
    public function getHref(): HrefInterface
66
    {
67 3
        return $this->href;
68
    }
69
70
    /**
71
     * {@inheritdoc}
72
     */
73 1
    public function setHref(HrefInterface $href): void
74
    {
75 1
        $this->href = $href;
76 1
    }
77
78
    /**
79
     * {@inheritdoc}
80
     */
81 3
    public function getAttributes(): array
82
    {
83 3
        return $this->attributes;
84
    }
85
86
    /**
87
     * {@inheritdoc}
88
     */
89 1
    public function setAttributes(array $attributes): void
90
    {
91 1
        $this->attributes = $attributes;
92 1
    }
93
}
94