Code Duplication    Length = 12-12 lines in 2 locations

src/Offer/Offer.php 2 locations

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