CI_Encryption::initialize PHP Method

initialize() public method

Initialize
public initialize ( array $params ) : CI_Encryption
$params array Configuration parameters
return CI_Encryption
    public function initialize(array $params)
    {
        if (!empty($params['driver'])) {
            if (isset($this->_drivers[$params['driver']])) {
                if ($this->_drivers[$params['driver']]) {
                    $this->_driver = $params['driver'];
                } else {
                    log_message('error', "Encryption: Driver '" . $params['driver'] . "' is not available.");
                }
            } else {
                log_message('error', "Encryption: Unknown driver '" . $params['driver'] . "' cannot be configured.");
            }
        }
        if (empty($this->_driver)) {
            $this->_driver = $this->_drivers['openssl'] === TRUE ? 'openssl' : 'mcrypt';
            log_message('debug', "Encryption: Auto-configured driver '" . $this->_driver . "'.");
        }
        empty($params['cipher']) && ($params['cipher'] = $this->_cipher);
        empty($params['key']) or $this->_key = $params['key'];
        $this->{'_' . $this->_driver . '_initialize'}($params);
        return $this;
    }