Link::type()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\RestResource;
4
5
final class Link
6
{
7
    /** @var string */
8
    private $path;
9
    /** @var RelationshipType */
10
    private $type;
11
12
    private function __construct(string $path, RelationshipType $type)
13
    {
14
        $this->path = $path;
15
        $this->type = $type;
16
    }
17
18
    public static function to(string $path, RelationshipType $type): self
19
    {
20
        return new self($path, $type);
21
    }
22
23
    /**
24
     * Retrieves the path this links to.
25
     *
26
     * @return string The path this link points to.
27
     */
28
    public function path(): string
29
    {
30
        return $this->path;
31
    }
32
33
    /**
34
     * Retrieves the type of relationship this link represents.
35
     *
36
     * @return RelationshipType The relationship type.
37
     */
38
    public function type(): RelationshipType
39
    {
40
        return $this->type;
41
    }
42
}
43