Code Duplication    Length = 17-17 lines in 2 locations

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

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