| 1 | <?php |
||
| 19 | class Post extends AggregateRoot |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * @var string |
||
| 23 | */ |
||
| 24 | protected $title; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @var string |
||
| 28 | */ |
||
| 29 | protected $content; |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @var bool |
||
| 33 | */ |
||
| 34 | protected $published = false; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Post constructor. |
||
| 38 | * |
||
| 39 | * @param PostId $id |
||
| 40 | * @param string $title |
||
| 41 | * @param string $content |
||
| 42 | */ |
||
| 43 | public function __construct(PostId $id, $title, $content) |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return string |
||
| 53 | */ |
||
| 54 | public function title() |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @return string |
||
| 61 | */ |
||
| 62 | public function content() |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @return bool |
||
| 69 | */ |
||
| 70 | public function published() |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @param $newTitle |
||
| 77 | */ |
||
| 78 | public function changeTitle($newTitle) |
||
| 82 | |||
| 83 | /** |
||
| 84 | * Publish a post. |
||
| 85 | */ |
||
| 86 | public function publish() |
||
| 90 | |||
| 91 | /** |
||
| 92 | * {@inheritdoc} |
||
| 93 | */ |
||
| 94 | public function equals($other) |
||
| 102 | } |
||
| 103 |