|
@@ 383-394 (lines=12) @@
|
| 380 |
|
* @return bool |
| 381 |
|
* @throws Exception |
| 382 |
|
*/ |
| 383 |
|
private function guardPublish() |
| 384 |
|
{ |
| 385 |
|
if ($this->workflowStatus === WorkflowStatus::READY_FOR_VALIDATION()) { |
| 386 |
|
return true; // nothing left to do if the offer has already been published |
| 387 |
|
} |
| 388 |
|
|
| 389 |
|
if ($this->workflowStatus !== WorkflowStatus::DRAFT()) { |
| 390 |
|
throw new Exception('You can not publish an offer that is not draft'); |
| 391 |
|
} |
| 392 |
|
|
| 393 |
|
return false; |
| 394 |
|
} |
| 395 |
|
|
| 396 |
|
/** |
| 397 |
|
* Approve the offer when it's waiting for validation. |
|
@@ 408-419 (lines=12) @@
|
| 405 |
|
* @return bool |
| 406 |
|
* @throws Exception |
| 407 |
|
*/ |
| 408 |
|
private function guardApprove() |
| 409 |
|
{ |
| 410 |
|
if ($this->workflowStatus === WorkflowStatus::APPROVED()) { |
| 411 |
|
return true; // nothing left to do if the offer has already been approved |
| 412 |
|
} |
| 413 |
|
|
| 414 |
|
if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) { |
| 415 |
|
throw new Exception('You can not approve an offer that is not ready for validation'); |
| 416 |
|
} |
| 417 |
|
|
| 418 |
|
return false; |
| 419 |
|
} |
| 420 |
|
|
| 421 |
|
/** |
| 422 |
|
* Reject an offer that is waiting for validation with a given reason. |