Code Duplication    Length = 39-50 lines in 9 locations

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

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

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

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

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

@@ 27-65 (lines=39) @@
24
/**
25
 * The natural identifier of an Identity is the SAML Name ID.
26
 */
27
final class NameId implements JsonSerializable
28
{
29
    /**
30
     * @var string
31
     */
32
    private $value;
33
34
    public function __construct($value)
35
    {
36
        if (!is_string($value)) {
37
            throw InvalidArgumentException::invalidType('string', 'value', $value);
38
        }
39
40
        $this->value = $value;
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function getNameId()
47
    {
48
        return $this->value;
49
    }
50
51
    public function equals($other)
52
    {
53
        return $this == $other;
54
    }
55
56
    public function __toString()
57
    {
58
        return $this->value;
59
    }
60
61
    public function jsonSerialize()
62
    {
63
        return $this->value;
64
    }
65
}
66

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

@@ 24-69 (lines=46) @@
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
    /**
53
     * @return string
54
     */
55
    public function getContactInformation()
56
    {
57
        return $this->contactInformation;
58
    }
59
60
    public function __toString()
61
    {
62
        return $this->contactInformation;
63
    }
64
65
    public function jsonSerialize()
66
    {
67
        return $this->contactInformation;
68
    }
69
}
70

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

@@ 24-69 (lines=46) @@
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
    /**
53
     * @return string
54
     */
55
    public function getLocation()
56
    {
57
        return $this->location;
58
    }
59
60
    public function __toString()
61
    {
62
        return $this->location;
63
    }
64
65
    public function jsonSerialize()
66
    {
67
        return $this->location;
68
    }
69
}
70

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

@@ 24-69 (lines=46) @@
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
    /**
53
     * @return string
54
     */
55
    public function getContactInformation()
56
    {
57
        return $this->contactInformation;
58
    }
59
60
    public function jsonSerialize()
61
    {
62
        return $this->contactInformation;
63
    }
64
65
    public function __toString()
66
    {
67
        return $this->contactInformation;
68
    }
69
}
70

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

@@ 24-69 (lines=46) @@
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
    /**
53
     * @return string
54
     */
55
    public function getLocation()
56
    {
57
        return $this->location;
58
    }
59
60
    public function jsonSerialize()
61
    {
62
        return $this->location;
63
    }
64
65
    public function __toString()
66
    {
67
        return $this->location;
68
    }
69
}
70

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

@@ 24-70 (lines=47) @@
21
use JsonSerializable;
22
use Surfnet\Stepup\Exception\InvalidArgumentException;
23
24
final class ShowRaaContactInformationOption implements JsonSerializable
25
{
26
    /**
27
     * @var bool
28
     */
29
    private $showRaaContactInformationOption;
30
31
    public static function getDefault()
32
    {
33
        return new self(true);
34
    }
35
36
    public function __construct($showRaaContactInformationOption)
37
    {
38
        if (!is_bool($showRaaContactInformationOption)) {
39
            throw InvalidArgumentException::invalidType(
40
                'boolean',
41
                'showRaaContactInformationOption',
42
                $showRaaContactInformationOption
43
            );
44
        }
45
46
        $this->showRaaContactInformationOption = $showRaaContactInformationOption;
47
    }
48
49
    /**
50
     * @param ShowRaaContactInformationOption $other
51
     * @return bool
52
     */
53
    public function equals(ShowRaaContactInformationOption $other)
54
    {
55
        return $this->showRaaContactInformationOption === $other->showRaaContactInformationOption;
56
    }
57
58
    /**
59
     * @return boolean
60
     */
61
    public function isEnabled()
62
    {
63
        return $this->showRaaContactInformationOption;
64
    }
65
66
    public function jsonSerialize()
67
    {
68
        return $this->showRaaContactInformationOption;
69
    }
70
}
71

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

@@ 24-73 (lines=50) @@
21
use JsonSerializable;
22
use Surfnet\Stepup\Exception\InvalidArgumentException;
23
24
final class UseRaLocationsOption implements JsonSerializable
25
{
26
    /**
27
     * @var bool
28
     */
29
    private $useRaLocationsOption;
30
31
    /**
32
     * @return UseRaLocationsOption
33
     */
34
    public static function getDefault()
35
    {
36
        return new self(false);
37
    }
38
39
    public function __construct($useRaLocationsOption)
40
    {
41
        if (!is_bool($useRaLocationsOption)) {
42
            throw InvalidArgumentException::invalidType(
43
                'boolean',
44
                'useRaLocationsOption',
45
                $useRaLocationsOption
46
            );
47
        }
48
49
        $this->useRaLocationsOption = $useRaLocationsOption;
50
    }
51
52
    /**
53
     * @param UseRaLocationsOption $other
54
     * @return bool
55
     */
56
    public function equals(UseRaLocationsOption $other)
57
    {
58
        return $this->useRaLocationsOption === $other->useRaLocationsOption;
59
    }
60
61
    /**
62
     * @return boolean
63
     */
64
    public function isEnabled()
65
    {
66
        return $this->useRaLocationsOption;
67
    }
68
69
    public function jsonSerialize()
70
    {
71
        return $this->useRaLocationsOption;
72
    }
73
}
74