Code Duplication    Length = 12-12 lines in 2 locations

src/Offer/Offer.php 2 locations

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