Code Duplication    Length = 16-17 lines in 2 locations

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

@@ 308-323 (lines=16) @@
305
    /**
306
     * {@inheritdoc}
307
     */
308
    public function loadContent($contentId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true)
309
    {
310
        $content = $this->internalLoadContent($contentId, $languages, $versionNo, false, $useAlwaysAvailable);
311
312
        if (!$this->repository->canUser('content', 'read', $content)) {
313
            throw new UnauthorizedException('content', 'read', array('contentId' => $contentId));
314
        }
315
        if (
316
            !$content->getVersionInfo()->isPublished()
317
            && !$this->repository->canUser('content', 'versionread', $content)
318
        ) {
319
            throw new UnauthorizedException('content', 'versionread', array('contentId' => $contentId, 'versionNo' => $versionNo));
320
        }
321
322
        return $content;
323
    }
324
325
    /**
326
     * Loads content in a version of the given content object.
@@ 414-430 (lines=17) @@
411
     *
412
     * @return \eZ\Publish\API\Repository\Values\Content\Content
413
     */
414
    public function loadContentByRemoteId($remoteId, array $languages = null, $versionNo = null, $useAlwaysAvailable = true)
415
    {
416
        $content = $this->internalLoadContent($remoteId, $languages, $versionNo, true, $useAlwaysAvailable);
417
418
        if (!$this->repository->canUser('content', 'read', $content)) {
419
            throw new UnauthorizedException('content', 'read', array('remoteId' => $remoteId));
420
        }
421
422
        if (
423
            !$content->getVersionInfo()->isPublished()
424
            && !$this->repository->canUser('content', 'versionread', $content)
425
        ) {
426
            throw new UnauthorizedException('content', 'versionread', array('remoteId' => $remoteId, 'versionNo' => $versionNo));
427
        }
428
429
        return $content;
430
    }
431
432
    /**
433
     * Creates a new content draft assigned to the authenticated user.