Code Duplication    Length = 38-38 lines in 6 locations

src/Surfnet/Stepup/Configuration/Value/ContactInformation.php 1 location

@@ 24-61 (lines=38) @@
21
use JsonSerializable;
22
use Surfnet\Stepup\Exception\InvalidArgumentException;
23
24
final class ContactInformation implements JsonSerializable
25
{
26
    /**
27
     * @var string
28
     */
29
    private $contactInformation;
30
31
    /**
32
     * @param string $contactInformation
33
     */
34
    public function __construct($contactInformation)
35
    {
36
        if (!is_string($contactInformation)) {
37
            throw InvalidArgumentException::invalidType('string', 'contactInformation', $contactInformation);
38
        }
39
40
        $this->contactInformation = trim($contactInformation);
41
    }
42
43
    /**
44
     * @param ContactInformation $otherContactInformation
45
     * @return bool
46
     */
47
    public function equals(ContactInformation $otherContactInformation)
48
    {
49
        return $this->contactInformation === $otherContactInformation->contactInformation;
50
    }
51
52
    public function jsonSerialize()
53
    {
54
        return (string) $this;
55
    }
56
57
    public function __toString()
58
    {
59
        return $this->contactInformation;
60
    }
61
}
62

src/Surfnet/Stepup/Configuration/Value/Location.php 1 location

@@ 24-61 (lines=38) @@
21
use JsonSerializable;
22
use Surfnet\Stepup\Exception\InvalidArgumentException;
23
24
final class Location implements JsonSerializable
25
{
26
    /**
27
     * @var string
28
     */
29
    private $location;
30
31
    /**
32
     * @param string $location
33
     */
34
    public function __construct($location)
35
    {
36
        if (!is_string($location)) {
37
            throw InvalidArgumentException::invalidType('string', 'location', $location);
38
        }
39
40
        $this->location = trim($location);
41
    }
42
43
    /**
44
     * @param Location $otherLocation
45
     * @return bool
46
     */
47
    public function equals(Location $otherLocation)
48
    {
49
        return $this->location === $otherLocation->location;
50
    }
51
52
    public function jsonSerialize()
53
    {
54
        return (string) $this;
55
    }
56
57
    public function __toString()
58
    {
59
        return $this->location;
60
    }
61
}
62

src/Surfnet/Stepup/Configuration/Value/RaLocationId.php 1 location

@@ 23-60 (lines=38) @@
20
21
use Surfnet\Stepup\Exception\InvalidArgumentException;
22
23
final class RaLocationId
24
{
25
    /**
26
     * @var string
27
     */
28
    private $raLocationId;
29
30
    /**
31
     * @param string $raLocationId
32
     */
33
    public function __construct($raLocationId)
34
    {
35
        if (!is_string($raLocationId) || trim($raLocationId) === '') {
36
            throw InvalidArgumentException::invalidType('non-empty string', 'raLocationId', $raLocationId);
37
        }
38
39
        $this->raLocationId = $raLocationId;
40
    }
41
42
    /**
43
     * @param RaLocationId $otherRaLocationId
44
     * @return bool
45
     */
46
    public function equals(RaLocationId $otherRaLocationId)
47
    {
48
        return $this->raLocationId === $otherRaLocationId->raLocationId;
49
    }
50
51
    public function jsonSerialize()
52
    {
53
        return (string) $this;
54
    }
55
56
    public function __toString()
57
    {
58
        return $this->raLocationId;
59
    }
60
}
61

src/Surfnet/Stepup/Configuration/Value/RaLocationName.php 1 location

@@ 7-44 (lines=38) @@
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

src/Surfnet/Stepup/Identity/Value/ContactInformation.php 1 location

@@ 24-61 (lines=38) @@
21
use JsonSerializable;
22
use Surfnet\Stepup\Exception\InvalidArgumentException;
23
24
final class ContactInformation implements JsonSerializable
25
{
26
    /**
27
     * @var string
28
     */
29
    private $contactInformation;
30
31
    /**
32
     * @param string $contactInformation
33
     */
34
    public function __construct($contactInformation)
35
    {
36
        if (!is_string($contactInformation)) {
37
            throw InvalidArgumentException::invalidType('string', 'contactInformation', $contactInformation);
38
        }
39
40
        $this->contactInformation = trim($contactInformation);
41
    }
42
43
    /**
44
     * @param ContactInformation $otherContactInformation
45
     * @return bool
46
     */
47
    public function equals(ContactInformation $otherContactInformation)
48
    {
49
        return $this->contactInformation === $otherContactInformation->contactInformation;
50
    }
51
52
    public function jsonSerialize()
53
    {
54
        return (string) $this;
55
    }
56
57
    public function __toString()
58
    {
59
        return $this->contactInformation;
60
    }
61
}
62

src/Surfnet/Stepup/Identity/Value/Location.php 1 location

@@ 24-61 (lines=38) @@
21
use JsonSerializable;
22
use Surfnet\Stepup\Exception\InvalidArgumentException;
23
24
final class Location implements JsonSerializable
25
{
26
    /**
27
     * @var string
28
     */
29
    private $location;
30
31
    /**
32
     * @param string $location
33
     */
34
    public function __construct($location)
35
    {
36
        if (!is_string($location)) {
37
            throw InvalidArgumentException::invalidType('string', 'location', $location);
38
        }
39
40
        $this->location = trim($location);
41
    }
42
43
    /**
44
     * @param Location $otherLocation
45
     * @return bool
46
     */
47
    public function equals(Location $otherLocation)
48
    {
49
        return $this->location === $otherLocation->location;
50
    }
51
52
    public function jsonSerialize()
53
    {
54
        return (string) $this;
55
    }
56
57
    public function __toString()
58
    {
59
        return $this->location;
60
    }
61
}
62