original_string: protected function _connect()
      {
          if ($this->_connection) {
              return;
          }
  
          if (!extension_loaded('mysqli')) {
              /**
               * @see Zend_Db_Adapter_Mysqli_Exception
               */
              // require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
              throw new Zend_Db_Adapter_Mysqli_Exception('The Mysqli extension is required for this adapter but the extension is not loaded');
          }
  
          if (isset($this->_config['port'])) {
              $port = (integer) $this->_config['port'];
          } else {
              $port = null;
          }
  
          $this->_connection = mysqli_init();
  
          $enable_ssl = false;
          $ssl_options = array (
              'ssl_ca' => null,
              'ssl_ca_path' => null,
              'ssl_cert' => null,
              'ssl_cipher' => null,
              'ssl_key' => null,
          );
  
          if(!empty($this->_config['driver_options'])) {
              foreach($this->_config['driver_options'] as $option=>$value) {
                  if(array_key_exists($option, $ssl_options)) {
                      $ssl_options[$option] = $value;
                      $enable_ssl = true;
                  } elseif(is_string($option)) {
                      // Suppress warnings here
                      // Ignore it if it's not a valid constant
                      $option = @constant(strtoupper($option));
                      if($option === null)
                          continue;
                  }
                  mysqli_options($this->_connection, $option, $value);
              }
          }
  
  
          if ($enable_ssl) {
              mysqli_ssl_set(
                  $this->_connection,
                  $ssl_options['ssl_key'],
                  $ssl_options['ssl_cert'],
                  $ssl_options['ssl_ca'],
                  $ssl_options['ssl_ca_path'],
                  $ssl_options['ssl_cipher']
              );
          }
  
          $flags = null;
          if ($enable_ssl) {
              $flags = MYSQLI_CLIENT_SSL;
              if (!empty($this->_config['driver_options']['ssl_no_verify'])
                  && defined('MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT')
              ) {
                  $flags = MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT;
              }
          }
  
          // Suppress connection warnings here.
          // Throw an exception instead.
          $_isConnected = @mysqli_real_connect(
              $this->_connection,
              $this->_config['host'],
              $this->_config['username'],
              $this->_config['password'],
              $this->_config['dbname'],
              $port,
              $socket = null,
              $enable_ssl ? $flags : null
          );
  
          if ($_isConnected === false || mysqli_connect_errno()) {
  
              $this->closeConnection();
              /**
               * @see Zend_Db_Adapter_Mysqli_Exception
               */
              // require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
              throw new Zend_Db_Adapter_Mysqli_Exception(mysqli_connect_error());
          }
  
          if (!empty($this->_config['charset'])) {
              mysqli_set_charset($this->_connection, $this->_config['charset']);
          }
      }
code: protected function _connect()
      {
          if ($this->_connection) {
              return;
          }
  
          if (!extension_loaded('mysqli')) {
              /**
               * @see Zend_Db_Adapter_Mysqli_Exception
               */
              // require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
              throw new Zend_Db_Adapter_Mysqli_Exception('The Mysqli extension is required for this adapter but the extension is not loaded');
          }
  
          if (isset($this->_config['port'])) {
              $port = (integer) $this->_config['port'];
          } else {
              $port = null;
          }
  
          $this->_connection = mysqli_init();
  
          $enable_ssl = false;
          $ssl_options = array (
              'ssl_ca' => null,
              'ssl_ca_path' => null,
              'ssl_cert' => null,
              'ssl_cipher' => null,
              'ssl_key' => null,
          );
  
          if(!empty($this->_config['driver_options'])) {
              foreach($this->_config['driver_options'] as $option=>$value) {
                  if(array_key_exists($option, $ssl_options)) {
                      $ssl_options[$option] = $value;
                      $enable_ssl = true;
                  } elseif(is_string($option)) {
                      // Suppress warnings here
                      // Ignore it if it's not a valid constant
                      $option = @constant(strtoupper($option));
                      if($option === null)
                          continue;
                  }
                  mysqli_options($this->_connection, $option, $value);
              }
          }
  
  
          if ($enable_ssl) {
              mysqli_ssl_set(
                  $this->_connection,
                  $ssl_options['ssl_key'],
                  $ssl_options['ssl_cert'],
                  $ssl_options['ssl_ca'],
                  $ssl_options['ssl_ca_path'],
                  $ssl_options['ssl_cipher']
              );
          }
  
          $flags = null;
          if ($enable_ssl) {
              $flags = MYSQLI_CLIENT_SSL;
              if (!empty($this->_config['driver_options']['ssl_no_verify'])
                  && defined('MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT')
              ) {
                  $flags = MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT;
              }
          }
  
          // Suppress connection warnings here.
          // Throw an exception instead.
          $_isConnected = @mysqli_real_connect(
              $this->_connection,
              $this->_config['host'],
              $this->_config['username'],
              $this->_config['password'],
              $this->_config['dbname'],
              $port,
              $socket = null,
              $enable_ssl ? $flags : null
          );
  
          if ($_isConnected === false || mysqli_connect_errno()) {
  
              $this->closeConnection();
              /**
               * @see Zend_Db_Adapter_Mysqli_Exception
               */
              // require_once 'Zend/Db/Adapter/Mysqli/Exception.php';
              throw new Zend_Db_Adapter_Mysqli_Exception(mysqli_connect_error());
          }
  
          if (!empty($this->_config['charset'])) {
              mysqli_set_charset($this->_connection, $this->_config['charset']);
          }
      }
code_tokens: protected function _connect ( ) { if ( $ this -> _connection ) { return ; } if ( ! extension_loaded ( 'mysqli' ) ) { /**
               * @see Zend_Db_Adapter_Mysqli_Exception
               */ // require_once 'Zend/Db/Adapter/Mysqli/Exception.php'; throw new Zend_Db_Adapter_Mysqli_Exception ( 'The Mysqli extension is required for this adapter but the extension is not loaded' ) ; } if ( isset ( $ this -> _config [ 'port' ] ) ) { $ port = ( integer ) $ this -> _config [ 'port' ] ; } else { $ port = null ; } $ this -> _connection = mysqli_init ( ) ; $ enable_ssl = false ; $ ssl_options = array ( 'ssl_ca' => null , 'ssl_ca_path' => null , 'ssl_cert' => null , 'ssl_cipher' => null , 'ssl_key' => null , ) ; if ( ! empty ( $ this -> _config [ 'driver_options' ] ) ) { foreach ( $ this -> _config [ 'driver_options' ] as $ option => $ value ) { if ( array_key_exists ( $ option , $ ssl_options ) ) { $ ssl_options [ $ option ] = $ value ; $ enable_ssl = true ; } elseif ( is_string ( $ option ) ) { // Suppress warnings here // Ignore it if it's not a valid constant $ option = @ constant ( strtoupper ( $ option ) ) ; if ( $ option === null ) continue ; } mysqli_options ( $ this -> _connection , $ option , $ value ) ; } } if ( $ enable_ssl ) { mysqli_ssl_set ( $ this -> _connection , $ ssl_options [ 'ssl_key' ] , $ ssl_options [ 'ssl_cert' ] , $ ssl_options [ 'ssl_ca' ] , $ ssl_options [ 'ssl_ca_path' ] , $ ssl_options [ 'ssl_cipher' ] ) ; } $ flags = null ; if ( $ enable_ssl ) { $ flags = MYSQLI_CLIENT_SSL ; if ( ! empty ( $ this -> _config [ 'driver_options' ] [ 'ssl_no_verify' ] ) && defined ( 'MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT' ) ) { $ flags = MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT ; } } // Suppress connection warnings here. // Throw an exception instead. $ _isConnected = @ mysqli_real_connect ( $ this -> _connection , $ this -> _config [ 'host' ] , $ this -> _config [ 'username' ] , $ this -> _config [ 'password' ] , $ this -> _config [ 'dbname' ] , $ port , $ socket = null , $ enable_ssl ? $ flags : null ) ; if ( $ _isConnected === false || mysqli_connect_errno ( ) ) { $ this -> closeConnection ( ) ; /**
               * @see Zend_Db_Adapter_Mysqli_Exception
               */ // require_once 'Zend/Db/Adapter/Mysqli/Exception.php'; throw new Zend_Db_Adapter_Mysqli_Exception ( mysqli_connect_error ( ) ) ; } if ( ! empty ( $ this -> _config [ 'charset' ] ) ) { mysqli_set_charset ( $ this -> _connection , $ this -> _config [ 'charset' ] ) ; } }
docstring: Creates a connection to the database.
  
  @return void
  @throws Zend_Db_Adapter_Mysqli_Exception
docstring_tokens: Creates a connection to the database .