Code Duplication    Length = 16-17 lines in 2 locations

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

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