Code Duplication    Length = 3-10 lines in 5 locations

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

@@ 1509-1515 (lines=7) @@
1506
            );
1507
        }
1508
1509
        if (!$this->repository->canUser('content', 'versionremove', $versionInfo)) {
1510
            throw new UnauthorizedException(
1511
                'content',
1512
                'versionremove',
1513
                array('contentId' => $versionInfo->contentInfo->id, 'versionNo' => $versionInfo->versionNo)
1514
            );
1515
        }
1516
1517
        $versionList = $this->persistenceHandler->contentHandler()->listVersions(
1518
            $versionInfo->contentInfo->id,
@@ 1590-1599 (lines=10) @@
1587
        $destinationLocation = $this->repository->getLocationService()->loadLocation(
1588
            $destinationLocationCreateStruct->parentLocationId
1589
        );
1590
        if (!$this->repository->canUser('content', 'create', $contentInfo, [$destinationLocation])) {
1591
            throw new UnauthorizedException(
1592
                'content',
1593
                'create',
1594
                [
1595
                    'parentLocationId' => $destinationLocationCreateStruct->parentLocationId,
1596
                    'sectionId' => $contentInfo->sectionId,
1597
                ]
1598
            );
1599
        }
1600
1601
        $defaultObjectStates = $this->getDefaultObjectStates();
1602
@@ 1694-1696 (lines=3) @@
1691
     */
1692
    public function loadReverseRelations(ContentInfo $contentInfo)
1693
    {
1694
        if (!$this->repository->canUser('content', 'reverserelatedlist', $contentInfo)) {
1695
            throw new UnauthorizedException('content', 'reverserelatedlist', array('contentId' => $contentInfo->id));
1696
        }
1697
1698
        $spiRelations = $this->persistenceHandler->contentHandler()->loadReverseRelations(
1699
            $contentInfo->id
@@ 1878-1887 (lines=10) @@
1875
        $this->repository->beginTransaction();
1876
        try {
1877
            foreach ($this->loadVersions($contentInfo) as $versionInfo) {
1878
                if (!$this->repository->canUser('content', 'remove', $versionInfo)) {
1879
                    throw new UnauthorizedException(
1880
                        'content',
1881
                        'remove',
1882
                        ['contentId' => $contentInfo->id, 'versionNo' => $versionInfo->versionNo]
1883
                    );
1884
                }
1885
1886
                if (!in_array($languageCode, $versionInfo->languageCodes)) {
1887
                    continue;
1888
                }
1889
1890
                $translationWasFound = true;
@@ 1977-1981 (lines=5) @@
1974
            );
1975
        }
1976
1977
        if (!$this->repository->canUser('content', 'edit', $versionInfo->contentInfo)) {
1978
            throw new UnauthorizedException(
1979
                'content', 'edit', ['contentId' => $versionInfo->contentInfo->id]
1980
            );
1981
        }
1982
1983
        if (!in_array($languageCode, $versionInfo->languageCodes)) {
1984
            throw new InvalidArgumentException(