|
@@ 754-765 (lines=12) @@
|
| 751 |
|
* @return bool |
| 752 |
|
* @throws Exception |
| 753 |
|
*/ |
| 754 |
|
private function guardPublish() |
| 755 |
|
{ |
| 756 |
|
if ($this->workflowStatus === WorkflowStatus::READY_FOR_VALIDATION()) { |
| 757 |
|
return true; // nothing left to do if the offer has already been published |
| 758 |
|
} |
| 759 |
|
|
| 760 |
|
if ($this->workflowStatus !== WorkflowStatus::DRAFT()) { |
| 761 |
|
throw new Exception('You can not publish an offer that is not draft'); |
| 762 |
|
} |
| 763 |
|
|
| 764 |
|
return false; |
| 765 |
|
} |
| 766 |
|
|
| 767 |
|
/** |
| 768 |
|
* Approve the offer when it's waiting for validation. |
|
@@ 779-790 (lines=12) @@
|
| 776 |
|
* @return bool |
| 777 |
|
* @throws Exception |
| 778 |
|
*/ |
| 779 |
|
private function guardApprove() |
| 780 |
|
{ |
| 781 |
|
if ($this->workflowStatus === WorkflowStatus::APPROVED()) { |
| 782 |
|
return true; // nothing left to do if the offer has already been approved |
| 783 |
|
} |
| 784 |
|
|
| 785 |
|
if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) { |
| 786 |
|
throw new Exception('You can not approve an offer that is not ready for validation'); |
| 787 |
|
} |
| 788 |
|
|
| 789 |
|
return false; |
| 790 |
|
} |
| 791 |
|
|
| 792 |
|
/** |
| 793 |
|
* Reject an offer that is waiting for validation with a given reason. |