ContactInformation   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A jsonSerialize() 0 3 1
A equals() 0 3 1
A getContactInformation() 0 3 1
A __toString() 0 3 1
A __construct() 0 3 1
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 2014 SURFnet bv
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\Identity\Value;
22
23
use JsonSerializable;
24
use Stringable;
25
26
final class ContactInformation implements JsonSerializable, Stringable
27
{
28
    private readonly string $contactInformation;
29
30
    public function __construct(string $contactInformation)
31
    {
32
        $this->contactInformation = trim($contactInformation);
0 ignored issues
show
Bug introduced by
The property contactInformation is declared read-only in Surfnet\Stepup\Identity\Value\ContactInformation.
Loading history...
33
    }
34
35
    public function equals(ContactInformation $otherContactInformation): bool
36
    {
37
        return $this->contactInformation === $otherContactInformation->contactInformation;
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    public function getContactInformation(): string
44
    {
45
        return $this->contactInformation;
46
    }
47
48
    public function jsonSerialize(): string
49
    {
50
        return $this->contactInformation;
51
    }
52
53
    public function __toString(): string
54
    {
55
        return $this->contactInformation;
56
    }
57
}
58