Code Duplication    Length = 17-17 lines in 2 locations

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

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