|
@@ 684-695 (lines=12) @@
|
| 681 |
|
* @return bool |
| 682 |
|
* @throws Exception |
| 683 |
|
*/ |
| 684 |
|
private function guardPublish() |
| 685 |
|
{ |
| 686 |
|
if ($this->workflowStatus === WorkflowStatus::READY_FOR_VALIDATION()) { |
| 687 |
|
return true; // nothing left to do if the offer has already been published |
| 688 |
|
} |
| 689 |
|
|
| 690 |
|
if ($this->workflowStatus !== WorkflowStatus::DRAFT()) { |
| 691 |
|
throw new Exception('You can not publish an offer that is not draft'); |
| 692 |
|
} |
| 693 |
|
|
| 694 |
|
return false; |
| 695 |
|
} |
| 696 |
|
|
| 697 |
|
/** |
| 698 |
|
* Approve the offer when it's waiting for validation. |
|
@@ 709-720 (lines=12) @@
|
| 706 |
|
* @return bool |
| 707 |
|
* @throws Exception |
| 708 |
|
*/ |
| 709 |
|
private function guardApprove() |
| 710 |
|
{ |
| 711 |
|
if ($this->workflowStatus === WorkflowStatus::APPROVED()) { |
| 712 |
|
return true; // nothing left to do if the offer has already been approved |
| 713 |
|
} |
| 714 |
|
|
| 715 |
|
if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) { |
| 716 |
|
throw new Exception('You can not approve an offer that is not ready for validation'); |
| 717 |
|
} |
| 718 |
|
|
| 719 |
|
return false; |
| 720 |
|
} |
| 721 |
|
|
| 722 |
|
/** |
| 723 |
|
* Reject an offer that is waiting for validation with a given reason. |