Code Duplication    Length = 16-17 lines in 2 locations

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

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