Code Duplication    Length = 17-17 lines in 2 locations

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

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