Code Duplication    Length = 12-12 lines in 2 locations

src/Offer/Offer.php 2 locations

@@ 395-406 (lines=12) @@
392
     * @return bool
393
     * @throws Exception
394
     */
395
    private function guardPublish()
396
    {
397
        if ($this->workflowStatus === WorkflowStatus::READY_FOR_VALIDATION()) {
398
            return true; // nothing left to do if the offer has already been published
399
        }
400
401
        if ($this->workflowStatus !== WorkflowStatus::DRAFT()) {
402
            throw new Exception('You can not publish an offer that is not draft');
403
        }
404
405
        return false;
406
    }
407
408
    /**
409
     * Approve the offer when it's waiting for validation.
@@ 420-431 (lines=12) @@
417
     * @return bool
418
     * @throws Exception
419
     */
420
    private function guardApprove()
421
    {
422
        if ($this->workflowStatus === WorkflowStatus::APPROVED()) {
423
            return true; // nothing left to do if the offer has already been approved
424
        }
425
426
        if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) {
427
            throw new Exception('You can not approve an offer that is not ready for validation');
428
        }
429
430
        return false;
431
    }
432
433
    /**
434
     * Reject an offer that is waiting for validation with a given reason.