Code Duplication    Length = 17-17 lines in 2 locations

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

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