| 1 | <?php |
||
| 10 | class JsonDocument implements ReadModelInterface |
||
| 11 | { |
||
| 12 | protected $id; |
||
| 13 | protected $body; |
||
| 14 | |||
| 15 | public function __construct($id, $rawBody = '{}') |
||
| 16 | { |
||
| 17 | $this->id = $id; |
||
| 18 | $this->body = $rawBody; |
||
| 19 | } |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @return string |
||
| 23 | */ |
||
| 24 | public function getId() |
||
| 28 | |||
| 29 | public function getBody() |
||
| 33 | |||
| 34 | public function getRawBody() |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @param \stdClass $body |
||
| 41 | * @return static |
||
| 42 | */ |
||
| 43 | public function withBody($body) |
||
| 47 | |||
| 48 | /** |
||
| 49 | * @param callable $fn |
||
| 50 | * @return |
||
| 51 | */ |
||
| 52 | public function apply(callable $fn) |
||
| 57 | } |
||
| 58 |