Code Duplication    Length = 16-17 lines in 2 locations

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

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