Code Duplication    Length = 38-38 lines in 5 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/RaLocationName.php 1 location

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

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