Code Duplication    Length = 17-17 lines in 2 locations

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

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