Code Duplication    Length = 17-17 lines in 2 locations

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

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