Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 345-361 (lines=17) @@
342
     *
343
     * @return \eZ\Publish\Core\REST\Server\Values\NoContent
344
     */
345
    public function deleteContentVersion($contentId, $versionNumber)
346
    {
347
        $versionInfo = $this->repository->getContentService()->loadVersionInfo(
348
            $this->repository->getContentService()->loadContentInfo($contentId),
349
            $versionNumber
350
        );
351
352
        if ($versionInfo->isPublished()) {
353
            throw new ForbiddenException('Version in status PUBLISHED cannot be deleted');
354
        }
355
356
        $this->repository->getContentService()->deleteVersion(
357
            $versionInfo
358
        );
359
360
        return new Values\NoContent();
361
    }
362
363
    /**
364
     * Remove the given Translation from the given Version Draft.
@@ 529-545 (lines=17) @@
526
     *
527
     * @return \eZ\Publish\Core\REST\Server\Values\NoContent
528
     */
529
    public function publishVersion($contentId, $versionNumber)
530
    {
531
        $versionInfo = $this->repository->getContentService()->loadVersionInfo(
532
            $this->repository->getContentService()->loadContentInfo($contentId),
533
            $versionNumber
534
        );
535
536
        if (!$versionInfo->isDraft()) {
537
            throw new ForbiddenException('Only version in status DRAFT can be published');
538
        }
539
540
        $this->repository->getContentService()->publishVersion(
541
            $versionInfo
542
        );
543
544
        return new Values\NoContent();
545
    }
546
547
    /**
548
     * Redirects to the relations of the current version.