| @@ 24-65 (lines=42) @@ | ||
| 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 function __construct($showRaaContactInformationOption) |
|
| 32 | { |
|
| 33 | if (!is_bool($showRaaContactInformationOption)) { |
|
| 34 | throw InvalidArgumentException::invalidType( |
|
| 35 | 'boolean', |
|
| 36 | 'showRaaContactInformationOption', |
|
| 37 | $showRaaContactInformationOption |
|
| 38 | ); |
|
| 39 | } |
|
| 40 | ||
| 41 | $this->showRaaContactInformationOption = $showRaaContactInformationOption; |
|
| 42 | } |
|
| 43 | ||
| 44 | /** |
|
| 45 | * @param ShowRaaContactInformationOption $other |
|
| 46 | * @return bool |
|
| 47 | */ |
|
| 48 | public function equals(ShowRaaContactInformationOption $other) |
|
| 49 | { |
|
| 50 | return $this->showRaaContactInformationOption === $other->showRaaContactInformationOption; |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| 54 | * @return boolean |
|
| 55 | */ |
|
| 56 | public function isEnabled() |
|
| 57 | { |
|
| 58 | return $this->showRaaContactInformationOption; |
|
| 59 | } |
|
| 60 | ||
| 61 | public function jsonSerialize() |
|
| 62 | { |
|
| 63 | return $this->showRaaContactInformationOption; |
|
| 64 | } |
|
| 65 | } |
|
| 66 | ||
| @@ 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 | ||
| @@ 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 | ||
| @@ 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 | ||