Completed
Pull Request — develop (#113)
by A.
09:14 queued 03:38
created

RaLocationName::__construct()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 8
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 8
loc 8
rs 9.4285
cc 3
eloc 4
nc 2
nop 1
1
<?php
2
3
namespace Surfnet\Stepup\Configuration\Value;
4
5
use Surfnet\Stepup\Exception\InvalidArgumentException;
6
7 View Code Duplication
final class RaLocationName
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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