CI_Encryption::__construct PHP Méthode

__construct() public méthode

Class constructor
public __construct ( array $params = [] ) : void
$params array Configuration parameters
Résultat void
    public function __construct(array $params = array())
    {
        $this->_drivers = array('mcrypt' => defined('MCRYPT_DEV_URANDOM'), 'openssl' => is_php('5.3.3') && extension_loaded('openssl'));
        if (!$this->_drivers['mcrypt'] && !$this->_drivers['openssl']) {
            show_error('Encryption: Unable to find an available encryption driver.');
        }
        isset(self::$func_override) or self::$func_override = extension_loaded('mbstring') && ini_get('mbstring.func_override');
        $this->initialize($params);
        if (!isset($this->_key) && self::strlen($key = config_item('encryption_key')) > 0) {
            $this->_key = $key;
        }
        log_message('info', 'Encryption Class Initialized');
    }

Usage Example

 /**
  * Constructor
  */
 public function __construct()
 {
     parent::__construct();
     // Set cipher to blowfish by default
     $this->_cipher = 'blowfish';
 }