Horde_Kolab_Server_Object_Kolabgroupofnames::generateId PHP Method

generateId() public method

Generates an ID for the given information.
public generateId ( array &$info ) : string | PEAR_Error
$info array The data of the object.
return string | PEAR_Error The ID.
    public function generateId(array &$info)
    {
        if ($this->exists()) {
            if (!isset($info[self::ATTRIBUTE_MAIL]) && !isset($info[self::ATTRIBUTE_CN])) {
                return false;
            }
            if (!isset($info[self::ATTRIBUTE_MAIL])) {
                $info[self::ATTRIBUTE_MAIL] = $this->get(self::ATTRIBUTE_MAIL);
            }
            if (!isset($info[self::ATTRIBUTE_CN])) {
                $info[self::ATTRIBUTE_CN] = $this->get(self::ATTRIBUTE_CN);
            }
        }
        if (isset($info[self::ATTRIBUTE_MAIL])) {
            $id = $info[self::ATTRIBUTE_MAIL];
        } else {
            $id = $info[self::ATTRIBUTE_CN];
        }
        if (is_array($id)) {
            $id = $id[0];
        }
        return self::ATTRIBUTE_CN . '=' . $this->server->structure->quoteForUid(trim($id, " \t\n\r\v,"));
    }