|
@@ 468-479 (lines=12) @@
|
| 465 |
|
* @return bool |
| 466 |
|
* @throws Exception |
| 467 |
|
*/ |
| 468 |
|
private function guardPublish() |
| 469 |
|
{ |
| 470 |
|
if ($this->workflowStatus === WorkflowStatus::READY_FOR_VALIDATION()) { |
| 471 |
|
return true; // nothing left to do if the offer has already been published |
| 472 |
|
} |
| 473 |
|
|
| 474 |
|
if ($this->workflowStatus !== WorkflowStatus::DRAFT()) { |
| 475 |
|
throw new Exception('You can not publish an offer that is not draft'); |
| 476 |
|
} |
| 477 |
|
|
| 478 |
|
return false; |
| 479 |
|
} |
| 480 |
|
|
| 481 |
|
/** |
| 482 |
|
* Approve the offer when it's waiting for validation. |
|
@@ 493-504 (lines=12) @@
|
| 490 |
|
* @return bool |
| 491 |
|
* @throws Exception |
| 492 |
|
*/ |
| 493 |
|
private function guardApprove() |
| 494 |
|
{ |
| 495 |
|
if ($this->workflowStatus === WorkflowStatus::APPROVED()) { |
| 496 |
|
return true; // nothing left to do if the offer has already been approved |
| 497 |
|
} |
| 498 |
|
|
| 499 |
|
if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) { |
| 500 |
|
throw new Exception('You can not approve an offer that is not ready for validation'); |
| 501 |
|
} |
| 502 |
|
|
| 503 |
|
return false; |
| 504 |
|
} |
| 505 |
|
|
| 506 |
|
/** |
| 507 |
|
* Reject an offer that is waiting for validation with a given reason. |