Code Duplication    Length = 17-17 lines in 2 locations

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

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