Horde_Group_Base::getName PHP Method

getName() public method

Returns a group name.
public getName ( mixed $gid ) : string
$gid mixed A group ID.
return string The group's name.
    public function getName($gid)
    {
        // Check list cache.
        if (($list = $this->_getListCache()) !== null) {
            if (!isset($list[$gid])) {
                throw new Horde_Exception_NotFound();
            }
            return $list[$gid];
        }
        // Check "exists" cache.
        if ($this->_checkExistsCache($gid) === false) {
            throw new Horde_Exception_NotFound();
        }
        // Check name cache.
        $sig = $this->_sig('name_' . $gid);
        try {
            if ($name = $this->_cache->get($sig, 0)) {
                return $name;
            }
        } catch (Horde_Cache_Exception $e) {
        }
        // Retrieve name.
        $name = $this->_getName($gid);
        // Update name cache.
        try {
            $this->_cache->set($sig, $name);
        } catch (Horde_Cache_Exception $e) {
        }
        return $name;
    }

Usage Example

示例#1
0
文件: Group.php 项目: horde/horde
 /**
  * Constructor.
  *
  * @param integer $permission       The folder permission as provided by
  *                                  Horde.
  * @param string $id                The group id.
  * @param Horde_Group_Base $groups  The horde group handler.
  */
 public function __construct($permission, $id, Horde_Group_Base $groups)
 {
     $this->_horde_id = $id;
     $this->_kolab_id = 'group:' . $groups->getName($id);
     parent::__construct($permission);
 }