Code Duplication    Length = 7-10 lines in 3 locations

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

@@ 1511-1517 (lines=7) @@
1508
            );
1509
        }
1510
1511
        if (!$this->repository->canUser('content', 'versionremove', $versionInfo)) {
1512
            throw new UnauthorizedException(
1513
                'content',
1514
                'versionremove',
1515
                array('contentId' => $versionInfo->contentInfo->id, 'versionNo' => $versionInfo->versionNo)
1516
            );
1517
        }
1518
1519
        $versionList = $this->persistenceHandler->contentHandler()->listVersions(
1520
            $versionInfo->contentInfo->id,
@@ 1592-1601 (lines=10) @@
1589
        $destinationLocation = $this->repository->getLocationService()->loadLocation(
1590
            $destinationLocationCreateStruct->parentLocationId
1591
        );
1592
        if (!$this->repository->canUser('content', 'create', $contentInfo, [$destinationLocation])) {
1593
            throw new UnauthorizedException(
1594
                'content',
1595
                'create',
1596
                [
1597
                    'parentLocationId' => $destinationLocationCreateStruct->parentLocationId,
1598
                    'sectionId' => $contentInfo->sectionId,
1599
                ]
1600
            );
1601
        }
1602
1603
        $defaultObjectStates = $this->getDefaultObjectStates();
1604
@@ 1903-1912 (lines=10) @@
1900
        $versions = [];
1901
        foreach ($this->loadVersions($contentInfo) as $versionInfo) {
1902
            // check if user is authorized to delete Version
1903
            if (!$this->repository->canUser('content', 'delete', $versionInfo)) {
1904
                throw new UnauthorizedException(
1905
                    'content',
1906
                    'delete',
1907
                    [
1908
                        'contentId' => $contentInfo->id,
1909
                        'versionNo' => $versionInfo->versionNo,
1910
                    ]
1911
                );
1912
            }
1913
            // check if the specified translation exists for the Version
1914
            if (!in_array($languageCode, $versionInfo->languageCodes)) {
1915
                // if translation does not exist, simply ignore Version (see InvalidArgumentException later on)