Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 334-350 (lines=17) @@
331
     *
332
     * @return \eZ\Publish\API\Repository\Values\Content\Content
333
     */
334
    public function loadContent($contentId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true)
335
    {
336
        $content = $this->internalLoadContent($contentId, $languages, $versionNo, false, $useAlwaysAvailable);
337
338
        if (!$this->repository->canUser('content', 'read', $content)) {
339
            throw new UnauthorizedException('content', 'read', array('contentId' => $contentId));
340
        }
341
342
        if (
343
            $content->getVersionInfo()->status !== APIVersionInfo::STATUS_PUBLISHED
344
            && !$this->repository->canUser('content', 'versionread', $content)
345
        ) {
346
            throw new UnauthorizedException('content', 'versionread', array('contentId' => $contentId, 'versionNo' => $versionNo));
347
        }
348
349
        return $content;
350
    }
351
352
    /**
353
     * Loads content in a version of the given content object.
@@ 439-455 (lines=17) @@
436
     *
437
     * @return \eZ\Publish\API\Repository\Values\Content\Content
438
     */
439
    public function loadContentByRemoteId($remoteId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true)
440
    {
441
        $content = $this->internalLoadContent($remoteId, $languages, $versionNo, true, $useAlwaysAvailable);
442
443
        if (!$this->repository->canUser('content', 'read', $content)) {
444
            throw new UnauthorizedException('content', 'read', array('remoteId' => $remoteId));
445
        }
446
447
        if (
448
            $content->getVersionInfo()->status !== APIVersionInfo::STATUS_PUBLISHED
449
            && !$this->repository->canUser('content', 'versionread', $content)
450
        ) {
451
            throw new UnauthorizedException('content', 'versionread', array('remoteId' => $remoteId, 'versionNo' => $versionNo));
452
        }
453
454
        return $content;
455
    }
456
457
    /**
458
     * Creates a new content draft assigned to the authenticated user.