|
@@ 613-624 (lines=12) @@
|
| 610 |
|
* @return bool |
| 611 |
|
* @throws Exception |
| 612 |
|
*/ |
| 613 |
|
private function guardPublish() |
| 614 |
|
{ |
| 615 |
|
if ($this->workflowStatus === WorkflowStatus::READY_FOR_VALIDATION()) { |
| 616 |
|
return true; // nothing left to do if the offer has already been published |
| 617 |
|
} |
| 618 |
|
|
| 619 |
|
if ($this->workflowStatus !== WorkflowStatus::DRAFT()) { |
| 620 |
|
throw new Exception('You can not publish an offer that is not draft'); |
| 621 |
|
} |
| 622 |
|
|
| 623 |
|
return false; |
| 624 |
|
} |
| 625 |
|
|
| 626 |
|
/** |
| 627 |
|
* Approve the offer when it's waiting for validation. |
|
@@ 638-649 (lines=12) @@
|
| 635 |
|
* @return bool |
| 636 |
|
* @throws Exception |
| 637 |
|
*/ |
| 638 |
|
private function guardApprove() |
| 639 |
|
{ |
| 640 |
|
if ($this->workflowStatus === WorkflowStatus::APPROVED()) { |
| 641 |
|
return true; // nothing left to do if the offer has already been approved |
| 642 |
|
} |
| 643 |
|
|
| 644 |
|
if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) { |
| 645 |
|
throw new Exception('You can not approve an offer that is not ready for validation'); |
| 646 |
|
} |
| 647 |
|
|
| 648 |
|
return false; |
| 649 |
|
} |
| 650 |
|
|
| 651 |
|
/** |
| 652 |
|
* Reject an offer that is waiting for validation with a given reason. |