Code Duplication    Length = 7-10 lines in 3 locations

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

@@ 1588-1597 (lines=10) @@
1585
     */
1586
    public function copyContent(ContentInfo $contentInfo, LocationCreateStruct $destinationLocationCreateStruct, APIVersionInfo $versionInfo = null)
1587
    {
1588
        if (!$this->repository->canUser('content', 'create', $contentInfo, $destinationLocationCreateStruct)) {
1589
            throw new UnauthorizedException(
1590
                'content',
1591
                'create',
1592
                array(
1593
                    'parentLocationId' => $destinationLocationCreateStruct->parentLocationId,
1594
                    'sectionId' => $contentInfo->sectionId,
1595
                )
1596
            );
1597
        }
1598
1599
        $defaultObjectStates = $this->getDefaultObjectStates();
1600
@@ 1510-1516 (lines=7) @@
1507
            );
1508
        }
1509
1510
        if (!$this->repository->canUser('content', 'versionremove', $versionInfo)) {
1511
            throw new UnauthorizedException(
1512
                'content',
1513
                'versionremove',
1514
                array('contentId' => $versionInfo->contentInfo->id, 'versionNo' => $versionInfo->versionNo)
1515
            );
1516
        }
1517
1518
        $versionList = $this->persistenceHandler->contentHandler()->listVersions(
1519
            $versionInfo->contentInfo->id,
@@ 1899-1908 (lines=10) @@
1896
        $versions = [];
1897
        foreach ($this->loadVersions($contentInfo) as $versionInfo) {
1898
            // check if user is authorized to delete Version
1899
            if (!$this->repository->canUser('content', 'delete', $versionInfo)) {
1900
                throw new UnauthorizedException(
1901
                    'content',
1902
                    'delete',
1903
                    [
1904
                        'contentId' => $contentInfo->id,
1905
                        'versionNo' => $versionInfo->versionNo,
1906
                    ]
1907
                );
1908
            }
1909
            // check if the specified translation exists for the Version
1910
            if (!in_array($languageCode, $versionInfo->languageCodes)) {
1911
                // if translation does not exist, simply ignore Version (see InvalidArgumentException later on)