CI_Encryption::_get_params PHP Méthode

_get_params() protected méthode

Get params
protected _get_params ( array $params ) : array
$params array Input parameters
Résultat array
    protected function _get_params($params)
    {
        if (empty($params)) {
            return isset($this->_cipher, $this->_mode, $this->_key, $this->_handle) ? array('handle' => $this->_handle, 'cipher' => $this->_cipher, 'mode' => $this->_mode, 'key' => NULL, 'base64' => TRUE, 'hmac_digest' => 'sha512', 'hmac_key' => NULL) : FALSE;
        } elseif (!isset($params['cipher'], $params['mode'], $params['key'])) {
            return FALSE;
        }
        if (isset($params['mode'])) {
            $params['mode'] = strtolower($params['mode']);
            if (!isset($this->_modes[$this->_driver][$params['mode']])) {
                return FALSE;
            } else {
                $params['mode'] = $this->_modes[$this->_driver][$params['mode']];
            }
        }
        if (isset($params['hmac']) && $params['hmac'] === FALSE) {
            $params['hmac_digest'] = $params['hmac_key'] = NULL;
        } else {
            if (!isset($params['hmac_key'])) {
                return FALSE;
            } elseif (isset($params['hmac_digest'])) {
                $params['hmac_digest'] = strtolower($params['hmac_digest']);
                if (!isset($this->_digests[$params['hmac_digest']])) {
                    return FALSE;
                }
            } else {
                $params['hmac_digest'] = 'sha512';
            }
        }
        $params = array('handle' => NULL, 'cipher' => $params['cipher'], 'mode' => $params['mode'], 'key' => $params['key'], 'base64' => isset($params['raw_data']) ? !$params['raw_data'] : FALSE, 'hmac_digest' => $params['hmac_digest'], 'hmac_key' => $params['hmac_key']);
        $this->_cipher_alias($params['cipher']);
        $params['handle'] = ($params['cipher'] !== $this->_cipher or $params['mode'] !== $this->_mode) ? $this->{'_' . $this->_driver . '_get_handle'}($params['cipher'], $params['mode']) : $this->_handle;
        return $params;
    }