Code Duplication    Length = 15-15 lines in 2 locations

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

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

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

@@ 827-841 (lines=15) @@
824
     *
825
     * @return \eZ\Publish\API\Repository\Values\User\Role[]
826
     */
827
    public function loadRoles()
828
    {
829
        if ($this->repository->hasAccess('role', 'read') !== true) {
830
            throw new UnauthorizedException('role', 'read');
831
        }
832
833
        $spiRoles = $this->userHandler->loadRoles();
834
835
        $roles = array();
836
        foreach ($spiRoles as $spiRole) {
837
            $roles[] = $this->roleDomainMapper->buildDomainRoleObject($spiRole);
838
        }
839
840
        return $roles;
841
    }
842
843
    /**
844
     * Deletes the given role.