Code Duplication    Length = 17-17 lines in 2 locations

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

@@ 611-627 (lines=17) @@
608
     *
609
     * @return \eZ\Publish\API\Repository\Values\Content\Location $location, with updated hidden value
610
     */
611
    public function hideLocation(APILocation $location)
612
    {
613
        if (!$this->repository->canUser('content', 'hide', $location->getContentInfo(), $location)) {
614
            throw new UnauthorizedException('content', 'hide', ['locationId' => $location->id]);
615
        }
616
617
        $this->repository->beginTransaction();
618
        try {
619
            $this->persistenceHandler->locationHandler()->hide($location->id);
620
            $this->repository->commit();
621
        } catch (Exception $e) {
622
            $this->repository->rollback();
623
            throw $e;
624
        }
625
626
        return $this->loadLocation($location->id);
627
    }
628
629
    /**
630
     * Unhides the $location.
@@ 641-657 (lines=17) @@
638
     *
639
     * @return \eZ\Publish\API\Repository\Values\Content\Location $location, with updated hidden value
640
     */
641
    public function unhideLocation(APILocation $location)
642
    {
643
        if (!$this->repository->canUser('content', 'hide', $location->getContentInfo(), $location)) {
644
            throw new UnauthorizedException('content', 'hide', ['locationId' => $location->id]);
645
        }
646
647
        $this->repository->beginTransaction();
648
        try {
649
            $this->persistenceHandler->locationHandler()->unHide($location->id);
650
            $this->repository->commit();
651
        } catch (Exception $e) {
652
            $this->repository->rollback();
653
            throw $e;
654
        }
655
656
        return $this->loadLocation($location->id);
657
    }
658
659
    /**
660
     * Moves the subtree to $newParentLocation.