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

@@ 860-873 (lines=14) @@
857
     *
858
     * @return \eZ\Publish\API\Repository\Values\User\Role
859
     */
860
    public function loadRoleByIdentifier($identifier)
861
    {
862
        if (!is_string($identifier)) {
863
            throw new InvalidArgumentValue('identifier', $identifier);
864
        }
865
866
        if ($this->repository->hasAccess('role', 'read') !== true) {
867
            throw new UnauthorizedException('role', 'read');
868
        }
869
870
        $spiRole = $this->userHandler->loadRoleByIdentifier($identifier);
871
872
        return $this->roleDomainMapper->buildDomainRoleObject($spiRole);
873
    }
874
875
    /**
876
     * Loads all roles.