Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 336-352 (lines=17) @@
333
     *
334
     * @return \eZ\Publish\API\Repository\Values\Content\Content
335
     */
336
    public function loadContent($contentId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true)
337
    {
338
        $content = $this->internalLoadContent($contentId, $languages, $versionNo, false, $useAlwaysAvailable);
339
340
        if (!$this->repository->canUser('content', 'read', $content)) {
341
            throw new UnauthorizedException('content', 'read', array('contentId' => $contentId));
342
        }
343
344
        if (
345
            $content->getVersionInfo()->status !== APIVersionInfo::STATUS_PUBLISHED
346
            && !$this->repository->canUser('content', 'versionread', $content)
347
        ) {
348
            throw new UnauthorizedException('content', 'versionread', array('contentId' => $contentId, 'versionNo' => $versionNo));
349
        }
350
351
        return $content;
352
    }
353
354
    /**
355
     * Loads content in a version of the given content object.
@@ 441-457 (lines=17) @@
438
     *
439
     * @return \eZ\Publish\API\Repository\Values\Content\Content
440
     */
441
    public function loadContentByRemoteId($remoteId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true)
442
    {
443
        $content = $this->internalLoadContent($remoteId, $languages, $versionNo, true, $useAlwaysAvailable);
444
445
        if (!$this->repository->canUser('content', 'read', $content)) {
446
            throw new UnauthorizedException('content', 'read', array('remoteId' => $remoteId));
447
        }
448
449
        if (
450
            $content->getVersionInfo()->status !== APIVersionInfo::STATUS_PUBLISHED
451
            && !$this->repository->canUser('content', 'versionread', $content)
452
        ) {
453
            throw new UnauthorizedException('content', 'versionread', array('remoteId' => $remoteId, 'versionNo' => $versionNo));
454
        }
455
456
        return $content;
457
    }
458
459
    /**
460
     * Bulk-load Content items by the list of ContentInfo Value Objects.