Example #1
0
 /**
  * @param   PDO|ezcDbHandler  $db
  * @return  ezcDbHandler
  */
 public static function wrapper($db)
 {
     // if (( $db instanceof ezcDbHandler) || ( $db instanceof ezcDbHandler)) {
     if ($db instanceof ezcDbInterface) {
         return $db;
     }
     if (!$db instanceof PDO) {
         throw new ezcBaseValueException('db', $db, ' is not PDO', 'parameter');
     }
     $impName = $db->getAttribute(PDO::ATTR_DRIVER_NAME);
     $className = 'ezcDbHandler' . strtoupper(substr($impName, 0, 1)) . substr($impName, 1);
     $instance = new $className($db);
     return $instance;
 }