Example #1
0
 /**
  * @return TodoStatus
  */
 public function todoStatus()
 {
     if (is_null($this->todoStatus)) {
         $this->todoStatus = TodoStatus::fromString($this->payload['status']);
     }
     return $this->todoStatus;
 }
 /**
  * @return TodoStatus
  */
 public function status()
 {
     if (null === $this->status) {
         $this->status = TodoStatus::fromString($this->payload['status']);
     }
     return $this->status;
 }
Example #3
0
 /**
  * @throws Exception\TodoNotOpen
  */
 public function markAsDone()
 {
     $status = TodoStatus::fromString('done');
     if (!$this->status->isOpen()) {
         throw Exception\TodoNotOpen::triedStatus($status, $this);
     }
     $this->recordThat(TodoWasMarkedAsDone::fromStatus($this->todoId, $this->status, $status));
 }
Example #4
0
 public function reopenTodo()
 {
     if (!$this->status->isDone()) {
         throw Exception\CannotReopenTodo::notMarkedDone($this);
     }
     $this->recordThat(TodoWasReopened::withStatus($this->todoId, TodoStatus::fromString(TodoStatus::OPEN)));
 }
 public function getEvent($todoId)
 {
     return TodoWasMarkedAsExpired::fromStatus(TodoId::fromString($todoId), TodoStatus::fromString(TodoStatus::OPEN), TodoStatus::fromString(TodoStatus::EXPIRED));
 }