Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 337-353 (lines=17) @@
334
     *
335
     * @return \eZ\Publish\API\Repository\Values\Content\Content
336
     */
337
    public function loadContent($contentId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true)
338
    {
339
        $content = $this->internalLoadContent($contentId, $languages, $versionNo, false, $useAlwaysAvailable);
340
341
        if (!$this->repository->canUser('content', 'read', $content)) {
342
            throw new UnauthorizedException('content', 'read', array('contentId' => $contentId));
343
        }
344
345
        if (
346
            $content->getVersionInfo()->status !== APIVersionInfo::STATUS_PUBLISHED
347
            && !$this->repository->canUser('content', 'versionread', $content)
348
        ) {
349
            throw new UnauthorizedException('content', 'versionread', array('contentId' => $contentId, 'versionNo' => $versionNo));
350
        }
351
352
        return $content;
353
    }
354
355
    /**
356
     * Loads content in a version of the given content object.
@@ 434-450 (lines=17) @@
431
     *
432
     * @return \eZ\Publish\API\Repository\Values\Content\Content
433
     */
434
    public function loadContentByRemoteId($remoteId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true)
435
    {
436
        $content = $this->internalLoadContent($remoteId, $languages, $versionNo, true, $useAlwaysAvailable);
437
438
        if (!$this->repository->canUser('content', 'read', $content)) {
439
            throw new UnauthorizedException('content', 'read', array('remoteId' => $remoteId));
440
        }
441
442
        if (
443
            $content->getVersionInfo()->status !== APIVersionInfo::STATUS_PUBLISHED
444
            && !$this->repository->canUser('content', 'versionread', $content)
445
        ) {
446
            throw new UnauthorizedException('content', 'versionread', array('remoteId' => $remoteId, 'versionNo' => $versionNo));
447
        }
448
449
        return $content;
450
    }
451
452
    /**
453
     * Bulk-load Content items by the list of ContentInfo Value Objects.