Code Duplication    Length = 12-12 lines in 2 locations

src/Offer/Offer.php 2 locations

@@ 786-797 (lines=12) @@
783
     * @return bool
784
     * @throws Exception
785
     */
786
    private function guardPublish()
787
    {
788
        if ($this->workflowStatus === WorkflowStatus::READY_FOR_VALIDATION()) {
789
            return true; // nothing left to do if the offer has already been published
790
        }
791
792
        if ($this->workflowStatus !== WorkflowStatus::DRAFT()) {
793
            throw new Exception('You can not publish an offer that is not draft');
794
        }
795
796
        return false;
797
    }
798
799
    /**
800
     * Approve the offer when it's waiting for validation.
@@ 811-822 (lines=12) @@
808
     * @return bool
809
     * @throws Exception
810
     */
811
    private function guardApprove()
812
    {
813
        if ($this->workflowStatus === WorkflowStatus::APPROVED()) {
814
            return true; // nothing left to do if the offer has already been approved
815
        }
816
817
        if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) {
818
            throw new Exception('You can not approve an offer that is not ready for validation');
819
        }
820
821
        return false;
822
    }
823
824
    /**
825
     * Reject an offer that is waiting for validation with a given reason.