Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 346-362 (lines=17) @@
343
     *
344
     * @return \eZ\Publish\Core\REST\Server\Values\NoContent
345
     */
346
    public function deleteContentVersion($contentId, $versionNumber)
347
    {
348
        $versionInfo = $this->repository->getContentService()->loadVersionInfo(
349
            $this->repository->getContentService()->loadContentInfo($contentId),
350
            $versionNumber
351
        );
352
353
        if ($versionInfo->isPublished()) {
354
            throw new ForbiddenException('Version in status PUBLISHED cannot be deleted');
355
        }
356
357
        $this->repository->getContentService()->deleteVersion(
358
            $versionInfo
359
        );
360
361
        return new Values\NoContent();
362
    }
363
364
    /**
365
     * Remove the given Translation of the given published Version and publish new one.
@@ 540-556 (lines=17) @@
537
     *
538
     * @return \eZ\Publish\Core\REST\Server\Values\NoContent
539
     */
540
    public function publishVersion($contentId, $versionNumber)
541
    {
542
        $versionInfo = $this->repository->getContentService()->loadVersionInfo(
543
            $this->repository->getContentService()->loadContentInfo($contentId),
544
            $versionNumber
545
        );
546
547
        if (!$versionInfo->isDraft()) {
548
            throw new ForbiddenException('Only version in status DRAFT can be published');
549
        }
550
551
        $this->repository->getContentService()->publishVersion(
552
            $versionInfo
553
        );
554
555
        return new Values\NoContent();
556
    }
557
558
    /**
559
     * Redirects to the relations of the current version.