Code Duplication    Length = 12-12 lines in 2 locations

src/Offer/Offer.php 2 locations

@@ 592-603 (lines=12) @@
589
     * @return bool
590
     * @throws Exception
591
     */
592
    private function guardPublish()
593
    {
594
        if ($this->workflowStatus === WorkflowStatus::READY_FOR_VALIDATION()) {
595
            return true; // nothing left to do if the offer has already been published
596
        }
597
598
        if ($this->workflowStatus !== WorkflowStatus::DRAFT()) {
599
            throw new Exception('You can not publish an offer that is not draft');
600
        }
601
602
        return false;
603
    }
604
605
    /**
606
     * Approve the offer when it's waiting for validation.
@@ 617-628 (lines=12) @@
614
     * @return bool
615
     * @throws Exception
616
     */
617
    private function guardApprove()
618
    {
619
        if ($this->workflowStatus === WorkflowStatus::APPROVED()) {
620
            return true; // nothing left to do if the offer has already been approved
621
        }
622
623
        if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) {
624
            throw new Exception('You can not approve an offer that is not ready for validation');
625
        }
626
627
        return false;
628
    }
629
630
    /**
631
     * Reject an offer that is waiting for validation with a given reason.