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

Currie   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 23.53%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 56
ccs 4
cts 17
cp 0.2353
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A getName() 0 4 1
A getHref() 0 4 2
A isTemplated() 0 4 1
A getResources() 0 4 1
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