Code Duplication    Length = 12-12 lines in 2 locations

src/Offer/Offer.php 2 locations

@@ 484-495 (lines=12) @@
481
     * @return bool
482
     * @throws Exception
483
     */
484
    private function guardPublish()
485
    {
486
        if ($this->workflowStatus === WorkflowStatus::READY_FOR_VALIDATION()) {
487
            return true; // nothing left to do if the offer has already been published
488
        }
489
490
        if ($this->workflowStatus !== WorkflowStatus::DRAFT()) {
491
            throw new Exception('You can not publish an offer that is not draft');
492
        }
493
494
        return false;
495
    }
496
497
    /**
498
     * Approve the offer when it's waiting for validation.
@@ 509-520 (lines=12) @@
506
     * @return bool
507
     * @throws Exception
508
     */
509
    private function guardApprove()
510
    {
511
        if ($this->workflowStatus === WorkflowStatus::APPROVED()) {
512
            return true; // nothing left to do if the offer has already been approved
513
        }
514
515
        if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) {
516
            throw new Exception('You can not approve an offer that is not ready for validation');
517
        }
518
519
        return false;
520
    }
521
522
    /**
523
     * Reject an offer that is waiting for validation with a given reason.