public function listRoles(Request $request)
    {
        $roles = array();
        if ($request->query->has('identifier')) {
            try {
                $role = $this->roleService->loadRoleByIdentifier($request->query->get('identifier'));
                $roles[] = $role;
            } catch (APINotFoundException $e) {
                // Do nothing
            }
        } else {
            $offset = $request->query->has('offset') ? (int)$request->query->get('offset') : 0;
            $limit = $request->query->has('limit') ? (int)$request->query->get('limit') : -1;

            $roles = array_slice(
                $this->roleService->loadRoles(),
                $offset >= 0 ? $offset : 0,
                $limit >= 0 ? $limit : null
            );
        }

        return new Values\RoleList($roles, $request->getPathInfo());
    }
public function listRoles(Request $request)
    {
        $roles = array();
        if ($request->query->has('identifier')) {
            try {
                $role = $this->roleService->loadRoleByIdentifier($request->query->get('identifier'));
                $roles[] = $role;
            } catch (APINotFoundException $e) {
                // Do nothing
            }
        } else {
            $offset = $request->query->has('offset') ? (int)$request->query->get('offset') : 0;
            $limit = $request->query->has('limit') ? (int)$request->query->get('limit') : -1;

            $roles = array_slice(
                $this->roleService->loadRoles(),
                $offset >= 0 ? $offset : 0,
                $limit >= 0 ? $limit : null
            );
        }

        return new Values\RoleList($roles, $request->getPathInfo());
    }
public function listRoles ( Request $ request ) { $ roles = array ( ) ; if ( $ request -> query -> has ( 'identifier' ) ) { try { $ role = $ this -> roleService -> loadRoleByIdentifier ( $ request -> query -> get ( 'identifier' ) ) ; $ roles [ ] = $ role ; } catch ( APINotFoundException $ e ) { // Do nothing } } else { $ offset = $ request -> query -> has ( 'offset' ) ? ( int ) $ request -> query -> get ( 'offset' ) : 0 ; $ limit = $ request -> query -> has ( 'limit' ) ? ( int ) $ request -> query -> get ( 'limit' ) : - 1 ; $ roles = array_slice ( $ this -> roleService -> loadRoles ( ) , $ offset >= 0 ? $ offset : 0 , $ limit >= 0 ? $ limit : null ) ; } return new Values \ RoleList ( $ roles , $ request -> getPathInfo ( ) ) ; }
Loads list of roles.

@return \eZ\Publish\Core\REST\Server\Values\RoleList
Loads list of roles .