Code Duplication    Length = 16-17 lines in 2 locations

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

@@ 310-325 (lines=16) @@
307
    /**
308
     * {@inheritdoc}
309
     */
310
    public function loadContent($contentId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true)
311
    {
312
        $content = $this->internalLoadContent($contentId, $languages, $versionNo, false, $useAlwaysAvailable);
313
314
        if (!$this->repository->canUser('content', 'read', $content)) {
315
            throw new UnauthorizedException('content', 'read', array('contentId' => $contentId));
316
        }
317
        if (
318
            !$content->getVersionInfo()->isPublished()
319
            && !$this->repository->canUser('content', 'versionread', $content)
320
        ) {
321
            throw new UnauthorizedException('content', 'versionread', array('contentId' => $contentId, 'versionNo' => $versionNo));
322
        }
323
324
        return $content;
325
    }
326
327
    /**
328
     * Loads content in a version of the given content object.
@@ 418-434 (lines=17) @@
415
     *
416
     * @return \eZ\Publish\API\Repository\Values\Content\Content
417
     */
418
    public function loadContentByRemoteId($remoteId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true)
419
    {
420
        $content = $this->internalLoadContent($remoteId, $languages, $versionNo, true, $useAlwaysAvailable);
421
422
        if (!$this->repository->canUser('content', 'read', $content)) {
423
            throw new UnauthorizedException('content', 'read', array('remoteId' => $remoteId));
424
        }
425
426
        if (
427
            !$content->getVersionInfo()->isPublished()
428
            && !$this->repository->canUser('content', 'versionread', $content)
429
        ) {
430
            throw new UnauthorizedException('content', 'versionread', array('remoteId' => $remoteId, 'versionNo' => $versionNo));
431
        }
432
433
        return $content;
434
    }
435
436
    /**
437
     * Bulk-load Content items by the list of ContentInfo Value Objects.