Completed
Push — feature/ra-locations-model ( d07346 )
by A.
05:06
created

RaLocation::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
rs 9.4285
cc 1
eloc 6
nc 1
nop 4
1
<?php
2
3
namespace Surfnet\Stepup\Configuration\Entity;
4
5
use Surfnet\Stepup\Configuration\Value\ContactInformation;
6
use Surfnet\Stepup\Configuration\Value\Institution;
7
use Surfnet\Stepup\Configuration\Value\Location;
8
use Surfnet\Stepup\Configuration\Value\RaLocationId;
9
use Surfnet\Stepup\Configuration\Value\RaLocationName;
10
11
class RaLocation
0 ignored issues
show
Coding Style introduced by
Since you have declared the constructor as private, maybe you should also declare the class as final.
Loading history...
12
{
13
    /**
14
     * @var RaLocationId
15
     */
16
    private $raLocationId;
17
18
    /**
19
     * @var RaLocationName
20
     */
21
    private $locationName;
22
23
    /**
24
     * @var Location
25
     */
26
    private $location;
27
28
    /**
29
     * @var ContactInformation
30
     */
31
    private $contactInformation;
32
33
    /**
34
     * @param RaLocationId $raLocationId
35
     * @param RaLocationName $raLocationName
36
     * @param Location $location
37
     * @param ContactInformation $contactInformation
38
     * @return RaLocation
39
     */
40
    public static function create(
41
        RaLocationId $raLocationId,
42
        RaLocationName $raLocationName,
43
        Location $location,
44
        ContactInformation $contactInformation
45
    ) {
46
        return new self($raLocationId, $raLocationName, $location, $contactInformation);
47
    }
48
49
    private function __construct(
50
        RaLocationId $raLocationId,
51
        RaLocationName $locationName,
52
        Location $location,
53
        ContactInformation $contactInformation
54
    ) {
55
        $this->raLocationId       = $raLocationId;
56
        $this->locationName       = $locationName;
57
        $this->location           = $location;
58
        $this->contactInformation = $contactInformation;
59
    }
60
61
    public function hasRaLocationId(RaLocationId $raLocationId)
62
    {
63
        return $this->raLocationId->equals($raLocationId);
64
    }
65
66
    /**
67
     * @return RaLocationId
68
     */
69
    public function getRaLocationId()
70
    {
71
        return $this->raLocationId;
72
    }
73
74
    /**
75
     * @return RaLocationName
76
     */
77
    public function getLocationName()
78
    {
79
        return $this->locationName;
80
    }
81
82
    /**
83
     * @return Location
84
     */
85
    public function getLocation()
86
    {
87
        return $this->location;
88
    }
89
90
    /**
91
     * @return ContactInformation
92
     */
93
    public function getContactInformation()
94
    {
95
        return $this->contactInformation;
96
    }
97
}
98