Documentation

Horde_Group_Mock extends Horde_Group_Base
in package

This class provides a mock driver for the Horde group system.

Tags
author

Duck duck@obala.net

category

Horde

copyright

2008-2017 Horde LLC

license

http://www.horde.org/licenses/lgpl21 LGPL 2.1

Table of Contents

CACHE_PREFIX  = 'horde_group_'
Cache prefix.
CACHE_VERSION  = 1
Cache version.
$_cache  : Horde_Cache
Cache object.
$_groups  : array<string|int, mixed>
List of groups.
$_log  : array<string|int, mixed>
Access log.
__construct()  : mixed
Constructor.
addUser()  : mixed
Add a user to a group.
clearLog()  : mixed
Resets the current method call log.
create()  : mixed
Creates a new group.
exists()  : bool
Checks if a group exists.
getCache()  : Horde_Cache
Returns the cache object.
getData()  : array<string|int, mixed>
Returns all available attributes of a group.
getLog()  : array<string|int, mixed>
Returns the current method call log.
getName()  : string
Returns a group name.
listAll()  : array<string|int, mixed>
Returns a list of all groups a user may see, with IDs as keys and names as values.
listGroups()  : array<string|int, mixed>
Returns a list of groups a user belongs to.
listUsers()  : array<string|int, mixed>
Returns a list of users in a group.
readOnly()  : bool
Returns whether the group backend is read-only.
remove()  : mixed
Removes a group.
removeUser()  : mixed
Removes a user from a group.
rename()  : mixed
Renames a group.
renameSupported()  : bool
Returns whether groups can be renamed.
search()  : array<string|int, mixed>
Searches for group names.
setCache()  : mixed
Sets a cache object.
setData()  : mixed
Sets one or more attributes of a group.
_addUser()  : mixed
Add a user to a group.
_checkExistsCache()  : mixed
_create()  : mixed
Creates a new group.
_exists()  : bool
Checks if a group exists.
_getData()  : array<string|int, mixed>
Returns all available attributes of a group.
_getListCache()  : array<string|int, mixed>
Returns the cached group list.
_getName()  : string
Returns a group name.
_listAll()  : array<string|int, mixed>
Returns a list of all groups a user may see, with IDs as keys and names as values.
_listGroups()  : array<string|int, mixed>
Returns a list of groups a user belongs to.
_listUsers()  : array<string|int, mixed>
Returns a list of users in a group.
_log()  : mixed
Logs a method call.
_remove()  : mixed
Removes a group.
_removeUser()  : mixed
Removes a user from a group.
_rename()  : mixed
Renames a group.
_search()  : array<string|int, mixed>
Searches for group names.
_setData()  : mixed
Sets one or more attributes of a group.
_setListCache()  : mixed
Sets the cached group list.
_sig()  : string
Returns a full cache key.

Constants

CACHE_PREFIX

Cache prefix.

public mixed CACHE_PREFIX = 'horde_group_'

CACHE_VERSION

Cache version.

public mixed CACHE_VERSION = 1

Properties

$_cache

Cache object.

protected Horde_Cache $_cache
Tags
since

Horde_Group 2.1.0

$_groups

List of groups.

protected array<string|int, mixed> $_groups = array()

$_log

Access log.

protected array<string|int, mixed> $_log = array()

Methods

__construct()

Constructor.

public __construct([mixed $params = array() ]) : mixed
Parameters
$params : mixed = array()
Return values
mixed

addUser()

Add a user to a group.

public addUser(mixed $gid, string $user) : mixed
Parameters
$gid : mixed

A group ID.

$user : string

A user name.

Tags
throws
Horde_Group_Exception
throws
Horde_Exception_NotFound
Return values
mixed

clearLog()

Resets the current method call log.

public clearLog() : mixed
Return values
mixed

create()

Creates a new group.

public create(string $name[, string $email = null ]) : mixed
Parameters
$name : string

A group name.

$email : string = null

The group's email address.

Tags
throws
Horde_Group_Exception
Return values
mixed

The ID of the created group.

exists()

Checks if a group exists.

public exists(mixed $gid) : bool
Parameters
$gid : mixed

A group ID.

Tags
throws
Horde_Group_Exception
Return values
bool

True if the group exists.

getCache()

Returns the cache object.

public getCache() : Horde_Cache
Tags
since

Horde_Group 2.1.0

Return values
Horde_Cache

getData()

Returns all available attributes of a group.

public getData(mixed $gid) : array<string|int, mixed>
Parameters
$gid : mixed

A group ID.

Tags
throws
Horde_Group_Exception
throws
Horde_Exception_NotFound
Return values
array<string|int, mixed>

The group's data.

getLog()

Returns the current method call log.

public getLog() : array<string|int, mixed>
Return values
array<string|int, mixed>

The current call log.

getName()

Returns a group name.

public getName(mixed $gid) : string
Parameters
$gid : mixed

A group ID.

Tags
throws
Horde_Group_Exception
throws
Horde_Exception_NotFound
Return values
string

The group's name.

listAll()

Returns a list of all groups a user may see, with IDs as keys and names as values.

public listAll([string $member = null ]) : array<string|int, mixed>
Parameters
$member : string = null

Only return groups that this user is a member of.

Tags
throws
Horde_Group_Exception
Return values
array<string|int, mixed>

All existing groups.

listGroups()

Returns a list of groups a user belongs to.

public listGroups(string $user) : array<string|int, mixed>
Parameters
$user : string

A user name.

Tags
throws
Horde_Group_Exception
Return values
array<string|int, mixed>

A list of groups, with IDs as keys and names as values.

listUsers()

Returns a list of users in a group.

public listUsers(mixed $gid) : array<string|int, mixed>
Parameters
$gid : mixed

A group ID.

Tags
throws
Horde_Group_Exception
throws
Horde_Exception_NotFound
Return values
array<string|int, mixed>

List of group users.

readOnly()

Returns whether the group backend is read-only.

public readOnly() : bool
Return values
bool

remove()

Removes a group.

public remove(mixed $gid) : mixed
Parameters
$gid : mixed

A group ID.

Tags
throws
Horde_Group_Exception
Return values
mixed

removeUser()

Removes a user from a group.

public removeUser(mixed $gid, string $user) : mixed
Parameters
$gid : mixed

A group ID.

$user : string

A user name.

Tags
throws
Horde_Group_Exception
throws
Horde_Exception_NotFound
Return values
mixed

rename()

Renames a group.

public rename(mixed $gid, string $name) : mixed
Parameters
$gid : mixed

A group ID.

$name : string

The new name.

Tags
throws
Horde_Group_Exception
throws
Horde_Exception_NotFound
Return values
mixed

renameSupported()

Returns whether groups can be renamed.

public renameSupported() : bool
Return values
bool

Searches for group names.

public search(string $name) : array<string|int, mixed>
Parameters
$name : string

A search string.

Tags
throws
Horde_Group_Exception
Return values
array<string|int, mixed>

A list of matching groups, with IDs as keys and names as values.

setCache()

Sets a cache object.

public setCache(Horde_Cache $cache) : mixed
Parameters
$cache : Horde_Cache

The cache object.

Tags
inject
since

Horde_Group 2.1.0

Return values
mixed

setData()

Sets one or more attributes of a group.

public setData(mixed $gid, array<string|int, mixed>|string $attribute[, string $value = null ]) : mixed
Parameters
$gid : mixed

A group ID.

$attribute : array<string|int, mixed>|string

An attribute name or a hash of attributes.

$value : string = null

An attribute value if $attribute is a string.

Tags
throws
Horde_Group_Exception
throws
Horde_Exception_NotFound
Return values
mixed

_addUser()

Add a user to a group.

protected _addUser(mixed $gid, string $user) : mixed
Parameters
$gid : mixed

A group ID.

$user : string

A user name.

Tags
throws
Horde_Group_Exception
Return values
mixed

_checkExistsCache()

protected _checkExistsCache(mixed $gid) : mixed
Parameters
$gid : mixed
Return values
mixed

_create()

Creates a new group.

protected _create(string $name[, string $email = null ]) : mixed
Parameters
$name : string

A group name.

$email : string = null

The group's email address.

Tags
throws
Horde_Group_Exception
Return values
mixed

The ID of the created group.

_exists()

Checks if a group exists.

protected _exists(mixed $gid) : bool
Parameters
$gid : mixed

A group ID.

Tags
throws
Horde_Group_Exception
Return values
bool

True if the group exists.

_getData()

Returns all available attributes of a group.

protected _getData(mixed $gid) : array<string|int, mixed>
Parameters
$gid : mixed

A group ID.

Tags
throws
Horde_Group_Exception
throws
Horde_Exception_NotFound
Return values
array<string|int, mixed>

The group's date.

_getListCache()

Returns the cached group list.

protected _getListCache([string $user = null ]) : array<string|int, mixed>
Parameters
$user : string = null

A user name.

Return values
array<string|int, mixed>

The group list or null if not cached.

_getName()

Returns a group name.

protected _getName(mixed $gid) : string
Parameters
$gid : mixed

A group ID.

Tags
throws
Horde_Group_Exception
Return values
string

The group's name.

_listAll()

Returns a list of all groups a user may see, with IDs as keys and names as values.

protected _listAll() : array<string|int, mixed>
Tags
throws
Horde_Group_Exception
Return values
array<string|int, mixed>

All existing groups.

_listGroups()

Returns a list of groups a user belongs to.

protected _listGroups(string $user) : array<string|int, mixed>
Parameters
$user : string

A user name.

Tags
throws
Horde_Group_Exception
Return values
array<string|int, mixed>

A list of groups, with IDs as keys and names as values.

_listUsers()

Returns a list of users in a group.

protected _listUsers(mixed $gid) : array<string|int, mixed>
Parameters
$gid : mixed

A group ID.

Tags
throws
Horde_Group_Exception
Return values
array<string|int, mixed>

List of group users.

_log()

Logs a method call.

protected _log() : mixed

Add the currently called class method to the call log.

Return values
mixed

_remove()

Removes a group.

protected _remove(mixed $gid) : mixed
Parameters
$gid : mixed

A group ID.

Tags
throws
Horde_Group_Exception
Return values
mixed

_removeUser()

Removes a user from a group.

protected _removeUser(mixed $gid, string $user) : mixed
Parameters
$gid : mixed

A group ID.

$user : string

A user name.

Tags
throws
Horde_Group_Exception
Return values
mixed

_rename()

Renames a group.

protected _rename(mixed $gid, string $name) : mixed
Parameters
$gid : mixed

A group ID.

$name : string

The new name.

Tags
throws
Horde_Group_Exception
Return values
mixed

Searches for group names.

protected _search(string $name) : array<string|int, mixed>
Parameters
$name : string

A search string.

Tags
throws
Horde_Group_Exception
Return values
array<string|int, mixed>

A list of matching groups, with IDs as keys and names as values.

_setData()

Sets one or more attributes of a group.

protected _setData(mixed $gid, array<string|int, mixed>|string $attribute[, string $value = null ]) : mixed
Parameters
$gid : mixed

A group ID.

$attribute : array<string|int, mixed>|string

An attribute name or a hash of attributes.

$value : string = null

An attribute value if $attribute is a string.

Tags
throws
Horde_Group_Exception
throws
Horde_Exception_NotFound
Return values
mixed

_setListCache()

Sets the cached group list.

protected _setListCache(array<string|int, mixed> $list[, string $user = null ]) : mixed
Parameters
$list : array<string|int, mixed>

A group list.

$user : string = null

A user name.

Return values
mixed

_sig()

Returns a full cache key.

protected _sig(string $key) : string
Parameters
$key : string

The internal key.

Return values
string

The full key for Horde_Cache consumption.

Search results