public function serializeMeta(Role $role, array $options)
    {
        $meta = [
           'readOnly' => $role->isReadOnly(),
           'personalWorkspaceCreationEnabled' => $role->getPersonalWorkspaceCreationEnabled(),
       ];

        if (in_array(Options::SERIALIZE_COUNT_USER, $options)) {
            if (Role::USER_ROLE !== $role->getType()) {
                $meta['users'] = $this->userRepo->countUsersByRoleIncludingGroup($role);
            } else {
                $meta['users'] = 1;
            }
        }

        return $meta;
    }
public function serializeMeta(Role $role, array $options)
    {
        $meta = [
           'readOnly' => $role->isReadOnly(),
           'personalWorkspaceCreationEnabled' => $role->getPersonalWorkspaceCreationEnabled(),
       ];

        if (in_array(Options::SERIALIZE_COUNT_USER, $options)) {
            if (Role::USER_ROLE !== $role->getType()) {
                $meta['users'] = $this->userRepo->countUsersByRoleIncludingGroup($role);
            } else {
                $meta['users'] = 1;
            }
        }

        return $meta;
    }
public function serializeMeta ( Role $ role , array $ options ) { $ meta = [ 'readOnly' => $ role -> isReadOnly ( ) , 'personalWorkspaceCreationEnabled' => $ role -> getPersonalWorkspaceCreationEnabled ( ) , ] ; if ( in_array ( Options :: SERIALIZE_COUNT_USER , $ options ) ) { if ( Role :: USER_ROLE !== $ role -> getType ( ) ) { $ meta [ 'users' ] = $ this -> userRepo -> countUsersByRoleIncludingGroup ( $ role ) ; } else { $ meta [ 'users' ] = 1 ; } } return $ meta ; }
Serialize role metadata.

@param Role  $role
@param array $options

@return array
Serialize role metadata .