Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 555-571 (lines=17) @@
552
     *
553
     * @return \eZ\Publish\API\Repository\Values\Content\Location $location, with updated hidden value
554
     */
555
    public function hideLocation(APILocation $location)
556
    {
557
        if (!$this->repository->canUser('content', 'hide', $location->getContentInfo(), $location)) {
558
            throw new UnauthorizedException('content', 'hide');
559
        }
560
561
        $this->repository->beginTransaction();
562
        try {
563
            $this->persistenceHandler->locationHandler()->hide($location->id);
564
            $this->repository->commit();
565
        } catch (Exception $e) {
566
            $this->repository->rollback();
567
            throw $e;
568
        }
569
570
        return $this->loadLocation($location->id);
571
    }
572
573
    /**
574
     * Unhides the $location.
@@ 585-601 (lines=17) @@
582
     *
583
     * @return \eZ\Publish\API\Repository\Values\Content\Location $location, with updated hidden value
584
     */
585
    public function unhideLocation(APILocation $location)
586
    {
587
        if (!$this->repository->canUser('content', 'hide', $location->getContentInfo(), $location)) {
588
            throw new UnauthorizedException('content', 'hide');
589
        }
590
591
        $this->repository->beginTransaction();
592
        try {
593
            $this->persistenceHandler->locationHandler()->unHide($location->id);
594
            $this->repository->commit();
595
        } catch (Exception $e) {
596
            $this->repository->rollback();
597
            throw $e;
598
        }
599
600
        return $this->loadLocation($location->id);
601
    }
602
603
    /**
604
     * Moves the subtree to $newParentLocation.