Code Duplication    Length = 17-17 lines in 2 locations

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

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