RaLocationName::getRaLocationName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/**
0 ignored issues
show
Coding Style introduced by
The file-level docblock must follow the opening PHP tag in the file header
Loading history...
6
 * Copyright 2016 SURFnet B.V.
7
 *
8
 * Licensed under the Apache License, Version 2.0 (the "License");
9
 * you may not use this file except in compliance with the License.
10
 * You may obtain a copy of the License at
11
 *
12
 *     http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20
21
namespace Surfnet\Stepup\Configuration\Value;
22
23
use JsonSerializable;
24
use Stringable;
25
use Surfnet\Stepup\Exception\InvalidArgumentException;
26
27
final class RaLocationName implements JsonSerializable, Stringable
28
{
29
    private readonly string $raLocationName;
30
31
    public function __construct(string $raLocationName)
32
    {
33
        if (trim($raLocationName) === '') {
34
            throw InvalidArgumentException::invalidType('non-empty string', 'raLocationName', $raLocationName);
35
        }
36
37
        $this->raLocationName = $raLocationName;
0 ignored issues
show
Bug introduced by
The property raLocationName is declared read-only in Surfnet\Stepup\Configuration\Value\RaLocationName.
Loading history...
38
    }
39
40
    public function equals(RaLocationName $otherRaLocationName): bool
41
    {
42
        return $this->raLocationName === $otherRaLocationName->raLocationName;
43
    }
44
45
    /**
46
     * @return string
47
     */
48
    public function getRaLocationName(): string
49
    {
50
        return $this->raLocationName;
51
    }
52
53
    public function __toString(): string
54
    {
55
        return $this->raLocationName;
56
    }
57
58
    public function jsonSerialize(): string
59
    {
60
        return $this->raLocationName;
61
    }
62
}
63