Code Duplication    Length = 17-17 lines in 2 locations

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

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