|
@@ 409-420 (lines=12) @@
|
| 406 |
|
* @return bool |
| 407 |
|
* @throws Exception |
| 408 |
|
*/ |
| 409 |
|
private function guardPublish() |
| 410 |
|
{ |
| 411 |
|
if ($this->workflowStatus === WorkflowStatus::READY_FOR_VALIDATION()) { |
| 412 |
|
return true; // nothing left to do if the offer has already been published |
| 413 |
|
} |
| 414 |
|
|
| 415 |
|
if ($this->workflowStatus !== WorkflowStatus::DRAFT()) { |
| 416 |
|
throw new Exception('You can not publish an offer that is not draft'); |
| 417 |
|
} |
| 418 |
|
|
| 419 |
|
return false; |
| 420 |
|
} |
| 421 |
|
|
| 422 |
|
/** |
| 423 |
|
* Approve the offer when it's waiting for validation. |
|
@@ 434-445 (lines=12) @@
|
| 431 |
|
* @return bool |
| 432 |
|
* @throws Exception |
| 433 |
|
*/ |
| 434 |
|
private function guardApprove() |
| 435 |
|
{ |
| 436 |
|
if ($this->workflowStatus === WorkflowStatus::APPROVED()) { |
| 437 |
|
return true; // nothing left to do if the offer has already been approved |
| 438 |
|
} |
| 439 |
|
|
| 440 |
|
if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) { |
| 441 |
|
throw new Exception('You can not approve an offer that is not ready for validation'); |
| 442 |
|
} |
| 443 |
|
|
| 444 |
|
return false; |
| 445 |
|
} |
| 446 |
|
|
| 447 |
|
/** |
| 448 |
|
* Reject an offer that is waiting for validation with a given reason. |