Code Duplication    Length = 12-12 lines in 2 locations

src/Offer/Offer.php 2 locations

@@ 459-470 (lines=12) @@
456
     * @return bool
457
     * @throws Exception
458
     */
459
    private function guardPublish()
460
    {
461
        if ($this->workflowStatus === WorkflowStatus::READY_FOR_VALIDATION()) {
462
            return true; // nothing left to do if the offer has already been published
463
        }
464
465
        if ($this->workflowStatus !== WorkflowStatus::DRAFT()) {
466
            throw new Exception('You can not publish an offer that is not draft');
467
        }
468
469
        return false;
470
    }
471
472
    /**
473
     * Approve the offer when it's waiting for validation.
@@ 484-495 (lines=12) @@
481
     * @return bool
482
     * @throws Exception
483
     */
484
    private function guardApprove()
485
    {
486
        if ($this->workflowStatus === WorkflowStatus::APPROVED()) {
487
            return true; // nothing left to do if the offer has already been approved
488
        }
489
490
        if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) {
491
            throw new Exception('You can not approve an offer that is not ready for validation');
492
        }
493
494
        return false;
495
    }
496
497
    /**
498
     * Reject an offer that is waiting for validation with a given reason.