Code Duplication    Length = 12-12 lines in 2 locations

src/Offer/Offer.php 2 locations

@@ 358-369 (lines=12) @@
355
     * @return bool
356
     * @throws Exception
357
     */
358
    private function guardPublish()
359
    {
360
        if ($this->workflowStatus === WorkflowStatus::READY_FOR_VALIDATION()) {
361
            return true; // nothing left to do if the offer has already been published
362
        }
363
364
        if ($this->workflowStatus !== WorkflowStatus::DRAFT()) {
365
            throw new Exception('You can not publish an offer that is not draft');
366
        }
367
368
        return false;
369
    }
370
371
    /**
372
     * Approve the offer when it's waiting for validation.
@@ 383-394 (lines=12) @@
380
     * @return bool
381
     * @throws Exception
382
     */
383
    private function guardApprove()
384
    {
385
        if ($this->workflowStatus === WorkflowStatus::APPROVED()) {
386
            return true; // nothing left to do if the offer has already been approved
387
        }
388
389
        if ($this->workflowStatus !== WorkflowStatus::READY_FOR_VALIDATION()) {
390
            throw new Exception('You can not approve an offer that is not ready for validation');
391
        }
392
393
        return false;
394
    }
395
396
    /**
397
     * Reject an offer that is waiting for validation with a given reason.