/**
  * Returns MySQLi instance.
  *
  * @return MySQLi
  */
 protected function getMySQLi()
 {
     $config = $this->getMySQLiConfiguration();
     $db = new MySQLi($config['host'], $config['username'], $config['password'], $config['database']);
     $db->set_charset($config['charset']);
     return $db;
 }
 /**
  * {@inheritdoc}
  */
 public function register(Container $app)
 {
     $app['mysqli'] = function () use($app) {
         if (isset($app['mysqli.configuration']) && is_array($app['mysqli.configuration'])) {
             $config = $app['mysqli.configuration'];
         } else {
             throw new \LogicException('mysqli.configuration is not defined');
         }
         $MySQLi = new MySQLi($config['host'], $config['username'], $config['password'], $config['database']);
         $MySQLi->set_charset($config['charset']);
         return $MySQLi;
     };
 }