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