Code Duplication    Length = 16-17 lines in 2 locations

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

@@ 306-321 (lines=16) @@
303
    /**
304
     * {@inheritdoc}
305
     */
306
    public function loadContent($contentId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true)
307
    {
308
        $content = $this->internalLoadContent($contentId, $languages, $versionNo, false, $useAlwaysAvailable);
309
310
        if (!$this->repository->canUser('content', 'read', $content)) {
311
            throw new UnauthorizedException('content', 'read', array('contentId' => $contentId));
312
        }
313
        if (
314
            !$content->getVersionInfo()->isPublished()
315
            && !$this->repository->canUser('content', 'versionread', $content)
316
        ) {
317
            throw new UnauthorizedException('content', 'versionread', array('contentId' => $contentId, 'versionNo' => $versionNo));
318
        }
319
320
        return $content;
321
    }
322
323
    /**
324
     * Loads content in a version of the given content object.
@@ 406-422 (lines=17) @@
403
     *
404
     * @return \eZ\Publish\API\Repository\Values\Content\Content
405
     */
406
    public function loadContentByRemoteId($remoteId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true)
407
    {
408
        $content = $this->internalLoadContent($remoteId, $languages, $versionNo, true, $useAlwaysAvailable);
409
410
        if (!$this->repository->canUser('content', 'read', $content)) {
411
            throw new UnauthorizedException('content', 'read', array('remoteId' => $remoteId));
412
        }
413
414
        if (
415
            !$content->getVersionInfo()->isPublished()
416
            && !$this->repository->canUser('content', 'versionread', $content)
417
        ) {
418
            throw new UnauthorizedException('content', 'versionread', array('remoteId' => $remoteId, 'versionNo' => $versionNo));
419
        }
420
421
        return $content;
422
    }
423
424
    /**
425
     * Bulk-load Content items by the list of ContentInfo Value Objects.