Code Duplication    Length = 16-17 lines in 2 locations

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

@@ 321-336 (lines=16) @@
318
    /**
319
     * {@inheritdoc}
320
     */
321
    public function loadContent($contentId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true)
322
    {
323
        $content = $this->internalLoadContent($contentId, $languages, $versionNo, false, $useAlwaysAvailable);
324
325
        if (!$this->repository->canUser('content', 'read', $content)) {
326
            throw new UnauthorizedException('content', 'read', array('contentId' => $contentId));
327
        }
328
        if (
329
            !$content->getVersionInfo()->isPublished()
330
            && !$this->repository->canUser('content', 'versionread', $content)
331
        ) {
332
            throw new UnauthorizedException('content', 'versionread', array('contentId' => $contentId, 'versionNo' => $versionNo));
333
        }
334
335
        return $content;
336
    }
337
338
    /**
339
     * Loads content in a version of the given content object.
@@ 423-439 (lines=17) @@
420
     *
421
     * @return \eZ\Publish\API\Repository\Values\Content\Content
422
     */
423
    public function loadContentByRemoteId($remoteId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true)
424
    {
425
        $content = $this->internalLoadContent($remoteId, $languages, $versionNo, true, $useAlwaysAvailable);
426
427
        if (!$this->repository->canUser('content', 'read', $content)) {
428
            throw new UnauthorizedException('content', 'read', array('remoteId' => $remoteId));
429
        }
430
431
        if (
432
            !$content->getVersionInfo()->isPublished()
433
            && !$this->repository->canUser('content', 'versionread', $content)
434
        ) {
435
            throw new UnauthorizedException('content', 'versionread', array('remoteId' => $remoteId, 'versionNo' => $versionNo));
436
        }
437
438
        return $content;
439
    }
440
441
    /**
442
     * Bulk-load Content items by the list of ContentInfo Value Objects.