Code Duplication    Length = 17-17 lines in 2 locations

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

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