Code Duplication    Length = 14-14 lines in 2 locations

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

@@ 221-234 (lines=14) @@
218
     *
219
     * @return \eZ\Publish\API\Repository\Values\Content\Section
220
     */
221
    public function loadSectionByIdentifier($sectionIdentifier)
222
    {
223
        if (!is_string($sectionIdentifier) || empty($sectionIdentifier)) {
224
            throw new InvalidArgumentValue('sectionIdentifier', $sectionIdentifier);
225
        }
226
227
        if ($this->repository->hasAccess('section', 'view') !== true) {
228
            throw new UnauthorizedException('section', 'view');
229
        }
230
231
        $spiSection = $this->sectionHandler->loadByIdentifier($sectionIdentifier);
232
233
        return $this->buildDomainSectionObject($spiSection);
234
    }
235
236
    /**
237
     * Counts the contents which $section is assigned to.

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

@@ 805-818 (lines=14) @@
802
     *
803
     * @return \eZ\Publish\API\Repository\Values\User\Role
804
     */
805
    public function loadRoleByIdentifier($identifier)
806
    {
807
        if (!is_string($identifier)) {
808
            throw new InvalidArgumentValue('identifier', $identifier);
809
        }
810
811
        if ($this->repository->hasAccess('role', 'read') !== true) {
812
            throw new UnauthorizedException('role', 'read');
813
        }
814
815
        $spiRole = $this->userHandler->loadRoleByIdentifier($identifier);
816
817
        return $this->roleDomainMapper->buildDomainRoleObject($spiRole);
818
    }
819
820
    /**
821
     * Loads all roles.