Code Duplication    Length = 12-12 lines in 2 locations

src/Offer/Offer.php 2 locations

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