Completed
Push — feature/ra-locations ( cdde00 )
by A.
04:54
created

RaLocationName   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 38
wmc 6
lcom 1
cbo 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 3
A equals() 0 4 1
A jsonSerialize() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
namespace Surfnet\Stepup\Configuration\Value;
4
5
use Surfnet\Stepup\Exception\InvalidArgumentException;
6
7
final class RaLocationName
8
{
9
    /**
10
     * @var string
11
     */
12
    private $raLocationName;
13
14
    /**
15
     * @param string $raLocationName
16
     */
17
    public function __construct($raLocationName)
18
    {
19
        if (!is_string($raLocationName) || trim($raLocationName) === '') {
20
            throw InvalidArgumentException::invalidType('non-empty string', 'raLocationName', $raLocationName);
21
        }
22
23
        $this->raLocationName = $raLocationName;
24
    }
25
26
    /**
27
     * @param RaLocationName $otherRaLocationName
28
     * @return bool
29
     */
30
    public function equals(RaLocationName $otherRaLocationName)
31
    {
32
        return $this->raLocationName === $otherRaLocationName->raLocationName;
33
    }
34
35
    public function jsonSerialize()
36
    {
37
        return (string) $this;
38
    }
39
40
    public function __toString()
41
    {
42
        return $this->raLocationName;
43
    }
44
}
45