Code Duplication    Length = 12-12 lines in 2 locations

src/Offer/Offer.php 2 locations

@@ 443-454 (lines=12) @@
440
     * @return bool
441
     * @throws Exception
442
     */
443
    private function guardPublish()
444
    {
445
        if ($this->workflowStatus === WorkflowStatus::READY_FOR_VALIDATION()) {
446
            return true; // nothing left to do if the offer has already been published
447
        }
448
449
        if ($this->workflowStatus !== WorkflowStatus::DRAFT()) {
450
            throw new Exception('You can not publish an offer that is not draft');
451
        }
452
453
        return false;
454
    }
455
456
    /**
457
     * Approve the offer when it's waiting for validation.
@@ 468-479 (lines=12) @@
465
     * @return bool
466
     * @throws Exception
467
     */
468
    private function guardApprove()
469
    {
470
        if ($this->workflowStatus === WorkflowStatus::APPROVED()) {
471
            return true; // nothing left to do if the offer has already been approved
472
        }
473
474
        if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) {
475
            throw new Exception('You can not approve an offer that is not ready for validation');
476
        }
477
478
        return false;
479
    }
480
481
    /**
482
     * Reject an offer that is waiting for validation with a given reason.