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