| @@ 9-25 (lines=17) @@ | ||
| 6 | use CultuurNet\Deserializer\MissingValueException; |
|
| 7 | use ValueObjects\String\String; |
|
| 8 | ||
| 9 | class DescriptionJSONDeserializer extends JSONDeserializer |
|
| 10 | { |
|
| 11 | /** |
|
| 12 | * @param String $data |
|
| 13 | * @return Description |
|
| 14 | */ |
|
| 15 | public function deserialize(String $data) |
|
| 16 | { |
|
| 17 | $data = parent::deserialize($data); |
|
| 18 | ||
| 19 | if (!isset($data->description)) { |
|
| 20 | throw new MissingValueException('Missing value for "description".'); |
|
| 21 | } |
|
| 22 | ||
| 23 | return new Description($data->description); |
|
| 24 | } |
|
| 25 | } |
|
| 26 | ||
| @@ 9-25 (lines=17) @@ | ||
| 6 | use CultuurNet\Deserializer\MissingValueException; |
|
| 7 | use ValueObjects\String\String; |
|
| 8 | ||
| 9 | class TitleJSONDeserializer extends JSONDeserializer |
|
| 10 | { |
|
| 11 | /** |
|
| 12 | * @param String $data |
|
| 13 | * @return Title |
|
| 14 | */ |
|
| 15 | public function deserialize(String $data) |
|
| 16 | { |
|
| 17 | $data = parent::deserialize($data); |
|
| 18 | ||
| 19 | if (!isset($data->title)) { |
|
| 20 | throw new MissingValueException('Missing value for "title".'); |
|
| 21 | } |
|
| 22 | ||
| 23 | return new Title($data->title); |
|
| 24 | } |
|
| 25 | } |
|
| 26 | ||