Horde_Prefs_Identity::__construct PHP Метод

__construct() публичный Метод

Constructor.
public __construct ( array $params = [] )
$params array Parameters: - default_identity: (string) The preference name for the default identity. DEFAULT: 'default_identity' - from_addr: (string) The preference name for the user's from e-mail address. DEFAULT: 'from_addr' - fullname: (string) The preference name for the user's full name. DEFAULT: 'fullname' - id: (string) The preference name for the identity name. DEFAULT: 'id' - identities: (string) The preference name for the identity store. DEFAULT: 'identities' - prefs: (Horde_Prefs) [REQUIRED] The prefs object to use. - properties: (array) The list of properties for the identity. DEFAULT: array('from_addr', 'fullname', 'id') - user: (string) [REQUIRED] The user whose prefs we are handling.
    public function __construct($params = array())
    {
        foreach (array_keys($this->_prefnames) as $val) {
            if (isset($params[$val])) {
                $this->_prefnames[$val] = $params[$val];
            }
        }
        $this->_prefs = $params['prefs'];
        $this->_user = $params['user'];
        if (!($this->_identities = @unserialize($this->_prefs->getValue($this->_prefnames['identities'])))) {
            $this->_identities = $this->_prefs->getDefault($this->_prefnames['identities']);
        }
        $this->setDefault($this->_prefs->getValue($this->_prefnames['default_identity']));
    }