Code Duplication    Length = 16-17 lines in 2 locations

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

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