Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 356-372 (lines=17) @@
353
     *
354
     * @return \eZ\Publish\Core\REST\Server\Values\NoContent
355
     */
356
    public function deleteContentVersion($contentId, $versionNumber)
357
    {
358
        $versionInfo = $this->repository->getContentService()->loadVersionInfo(
359
            $this->repository->getContentService()->loadContentInfo($contentId),
360
            $versionNumber
361
        );
362
363
        if ($versionInfo->status === VersionInfo::STATUS_PUBLISHED) {
364
            throw new ForbiddenException('Version in status PUBLISHED cannot be deleted');
365
        }
366
367
        $this->repository->getContentService()->deleteVersion(
368
            $versionInfo
369
        );
370
371
        return new Values\NoContent();
372
    }
373
374
    /**
375
     * The system creates a new draft version as a copy from the given version.
@@ 515-531 (lines=17) @@
512
     *
513
     * @return \eZ\Publish\Core\REST\Server\Values\NoContent
514
     */
515
    public function publishVersion($contentId, $versionNumber)
516
    {
517
        $versionInfo = $this->repository->getContentService()->loadVersionInfo(
518
            $this->repository->getContentService()->loadContentInfo($contentId),
519
            $versionNumber
520
        );
521
522
        if ($versionInfo->status !== VersionInfo::STATUS_DRAFT) {
523
            throw new ForbiddenException('Only version in status DRAFT can be published');
524
        }
525
526
        $this->repository->getContentService()->publishVersion(
527
            $versionInfo
528
        );
529
530
        return new Values\NoContent();
531
    }
532
533
    /**
534
     * Redirects to the relations of the current version.