Completed
Pull Request — master (#293)
by
unknown
02:49
created

Currie::getResources()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
namespace League\Fractal\Hal;
4
5
use League\Fractal\Helper\Validator;
6
7
class Currie
8
{
9
    const RELATION = '/{rel}';
10
11
    private $name;
12
13
    private $href;
14
15
    private $templated = false;
16
17
    private $resources;
18
19 2
    public function __construct($name, $href, $templated, array $resources)
20
    {
21 2
        Validator::validateParamString('name', $name);
22 1
        Validator::validateParamString('href', $href);
23 1
        Validator::validateParamBool('templated', $templated);
24
25
        $this->name = $name;
26
        $this->href = $href;
27
        $this->templated = $templated;
28
        $this->resources = $resources;
29
    }
30
31
    /**
32
     * @return string
33
     */
34
    public function getName()
35
    {
36
        return $this->name;
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    public function getHref()
43
    {
44
        return $this->href ? $this->href . static::RELATION : '';
45
    }
46
47
    /**
48
     * @return boolean
49
     */
50
    public function isTemplated()
51
    {
52
        return $this->templated;
53
    }
54
55
    /**
56
     * @return CurrieResource[]
57
     */
58
    public function getResources()
59
    {
60
        return $this->resources;
61
    }
62
}
63