Code Duplication    Length = 17-17 lines in 2 locations

eZ/Publish/Core/Repository/ContentService.php 2 locations

@@ 352-368 (lines=17) @@
349
     *
350
     * @return \eZ\Publish\API\Repository\Values\Content\Content
351
     */
352
    public function loadContent($contentId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true)
353
    {
354
        $content = $this->internalLoadContent($contentId, $languages, $versionNo, false, $useAlwaysAvailable);
355
356
        if (!$this->repository->canUser('content', 'read', $content)) {
357
            throw new UnauthorizedException('content', 'read', array('contentId' => $contentId));
358
        }
359
360
        if (
361
            $content->getVersionInfo()->status !== APIVersionInfo::STATUS_PUBLISHED
362
            && !$this->repository->canUser('content', 'versionread', $content)
363
        ) {
364
            throw new UnauthorizedException('content', 'versionread', array('contentId' => $contentId, 'versionNo' => $versionNo));
365
        }
366
367
        return $content;
368
    }
369
370
    /**
371
     * Loads content in a version of the given content object.
@@ 457-473 (lines=17) @@
454
     *
455
     * @return \eZ\Publish\API\Repository\Values\Content\Content
456
     */
457
    public function loadContentByRemoteId($remoteId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true)
458
    {
459
        $content = $this->internalLoadContent($remoteId, $languages, $versionNo, true, $useAlwaysAvailable);
460
461
        if (!$this->repository->canUser('content', 'read', $content)) {
462
            throw new UnauthorizedException('content', 'read', array('remoteId' => $remoteId));
463
        }
464
465
        if (
466
            $content->getVersionInfo()->status !== APIVersionInfo::STATUS_PUBLISHED
467
            && !$this->repository->canUser('content', 'versionread', $content)
468
        ) {
469
            throw new UnauthorizedException('content', 'versionread', array('remoteId' => $remoteId, 'versionNo' => $versionNo));
470
        }
471
472
        return $content;
473
    }
474
475
    /**
476
     * Creates a new content draft assigned to the authenticated user.