Code Duplication    Length = 12-12 lines in 2 locations

src/Offer/Offer.php 2 locations

@@ 625-636 (lines=12) @@
622
     * @return bool
623
     * @throws Exception
624
     */
625
    private function guardPublish()
626
    {
627
        if ($this->workflowStatus === WorkflowStatus::READY_FOR_VALIDATION()) {
628
            return true; // nothing left to do if the offer has already been published
629
        }
630
631
        if ($this->workflowStatus !== WorkflowStatus::DRAFT()) {
632
            throw new Exception('You can not publish an offer that is not draft');
633
        }
634
635
        return false;
636
    }
637
638
    /**
639
     * Approve the offer when it's waiting for validation.
@@ 650-661 (lines=12) @@
647
     * @return bool
648
     * @throws Exception
649
     */
650
    private function guardApprove()
651
    {
652
        if ($this->workflowStatus === WorkflowStatus::APPROVED()) {
653
            return true; // nothing left to do if the offer has already been approved
654
        }
655
656
        if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) {
657
            throw new Exception('You can not approve an offer that is not ready for validation');
658
        }
659
660
        return false;
661
    }
662
663
    /**
664
     * Reject an offer that is waiting for validation with a given reason.