Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 365-381 (lines=17) @@
362
     *
363
     * @return \eZ\Publish\Core\REST\Server\Values\NoContent
364
     */
365
    public function deleteContentVersion($contentId, $versionNumber)
366
    {
367
        $versionInfo = $this->repository->getContentService()->loadVersionInfo(
368
            $this->repository->getContentService()->loadContentInfo($contentId),
369
            $versionNumber
370
        );
371
372
        if ($versionInfo->status === VersionInfo::STATUS_PUBLISHED) {
373
            throw new ForbiddenException('Version in status PUBLISHED cannot be deleted');
374
        }
375
376
        $this->repository->getContentService()->deleteVersion(
377
            $versionInfo
378
        );
379
380
        return new Values\NoContent();
381
    }
382
383
    /**
384
     * The system creates a new draft version as a copy from the given version.
@@ 524-540 (lines=17) @@
521
     *
522
     * @return \eZ\Publish\Core\REST\Server\Values\NoContent
523
     */
524
    public function publishVersion($contentId, $versionNumber)
525
    {
526
        $versionInfo = $this->repository->getContentService()->loadVersionInfo(
527
            $this->repository->getContentService()->loadContentInfo($contentId),
528
            $versionNumber
529
        );
530
531
        if ($versionInfo->status !== VersionInfo::STATUS_DRAFT) {
532
            throw new ForbiddenException('Only version in status DRAFT can be published');
533
        }
534
535
        $this->repository->getContentService()->publishVersion(
536
            $versionInfo
537
        );
538
539
        return new Values\NoContent();
540
    }
541
542
    /**
543
     * Redirects to the relations of the current version.