Code Duplication    Length = 17-17 lines in 2 locations

eZ/Publish/Core/REST/Server/Controller/Content.php 2 locations

@@ 379-395 (lines=17) @@
376
     *
377
     * @return \eZ\Publish\Core\REST\Server\Values\NoContent
378
     */
379
    public function deleteContentVersion($contentId, $versionNumber)
380
    {
381
        $versionInfo = $this->repository->getContentService()->loadVersionInfo(
382
            $this->repository->getContentService()->loadContentInfo($contentId),
383
            $versionNumber
384
        );
385
386
        if ($versionInfo->isPublished()) {
387
            throw new ForbiddenException('Version in status PUBLISHED cannot be deleted');
388
        }
389
390
        $this->repository->getContentService()->deleteVersion(
391
            $versionInfo
392
        );
393
394
        return new Values\NoContent();
395
    }
396
397
    /**
398
     * Remove the given Translation from the given Version Draft.
@@ 563-579 (lines=17) @@
560
     *
561
     * @return \eZ\Publish\Core\REST\Server\Values\NoContent
562
     */
563
    public function publishVersion($contentId, $versionNumber)
564
    {
565
        $versionInfo = $this->repository->getContentService()->loadVersionInfo(
566
            $this->repository->getContentService()->loadContentInfo($contentId),
567
            $versionNumber
568
        );
569
570
        if (!$versionInfo->isDraft()) {
571
            throw new ForbiddenException('Only version in status DRAFT can be published');
572
        }
573
574
        $this->repository->getContentService()->publishVersion(
575
            $versionInfo
576
        );
577
578
        return new Values\NoContent();
579
    }
580
581
    /**
582
     * Redirects to the relations of the current version.