Code Duplication    Length = 12-12 lines in 2 locations

src/Offer/Offer.php 2 locations

@@ 737-748 (lines=12) @@
734
     * @return bool
735
     * @throws Exception
736
     */
737
    private function guardPublish()
738
    {
739
        if ($this->workflowStatus === WorkflowStatus::READY_FOR_VALIDATION()) {
740
            return true; // nothing left to do if the offer has already been published
741
        }
742
743
        if ($this->workflowStatus !== WorkflowStatus::DRAFT()) {
744
            throw new Exception('You can not publish an offer that is not draft');
745
        }
746
747
        return false;
748
    }
749
750
    /**
751
     * Approve the offer when it's waiting for validation.
@@ 762-773 (lines=12) @@
759
     * @return bool
760
     * @throws Exception
761
     */
762
    private function guardApprove()
763
    {
764
        if ($this->workflowStatus === WorkflowStatus::APPROVED()) {
765
            return true; // nothing left to do if the offer has already been approved
766
        }
767
768
        if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) {
769
            throw new Exception('You can not approve an offer that is not ready for validation');
770
        }
771
772
        return false;
773
    }
774
775
    /**
776
     * Reject an offer that is waiting for validation with a given reason.