Code Duplication    Length = 15-15 lines in 2 locations

eZ/Publish/Core/Repository/RoleService.php 1 location

@@ 856-870 (lines=15) @@
853
     *
854
     * @return \eZ\Publish\API\Repository\Values\User\Role[]
855
     */
856
    public function loadRoles()
857
    {
858
        if ($this->repository->hasAccess('role', 'read') !== true) {
859
            throw new UnauthorizedException('role', 'read');
860
        }
861
862
        $spiRoles = $this->userHandler->loadRoles();
863
864
        $roles = array();
865
        foreach ($spiRoles as $spiRole) {
866
            $roles[] = $this->roleDomainMapper->buildDomainRoleObject($spiRole);
867
        }
868
869
        return $roles;
870
    }
871
872
    /**
873
     * Deletes the given role.

eZ/Publish/Core/Repository/SectionService.php 1 location

@@ 197-211 (lines=15) @@
194
     *
195
     * @return \eZ\Publish\API\Repository\Values\Content\Section[]
196
     */
197
    public function loadSections()
198
    {
199
        if ($this->repository->hasAccess('section', 'view') !== true) {
200
            throw new UnauthorizedException('section', 'view');
201
        }
202
203
        $spiSections = $this->sectionHandler->loadAll();
204
205
        $sections = array();
206
        foreach ($spiSections as $spiSection) {
207
            $sections[] = $this->buildDomainSectionObject($spiSection);
208
        }
209
210
        return $sections;
211
    }
212
213
    /**
214
     * Loads a Section from its identifier ($sectionIdentifier).