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