Beispiel #1
0
 public function setDispatcher($name, $callback)
 {
     if (!is_callable($callback)) {
         throw StorageError::not_callable("Storage dispatcher {$name}");
     }
     $this->dispatcher[$name] = $callback;
     return $this;
 }
Beispiel #2
0
 public function __construct(array $config)
 {
     if (!extension_loaded('redis')) {
         throw StorageError::require_extension('redis');
     }
     if ($config) {
         $this->config = array_merge($this->config, $config);
     }
 }
Beispiel #3
0
 /**
  * 魔法方法
  * 直接调用PDO连接对象
  *
  * @param string $fn
  * @param array $args
  * @access public
  * @return mixed
  */
 public function __call($fn, $args)
 {
     $this->connect();
     if (method_exists($this->dbh, $fn)) {
         return call_user_func_array(array($this->dbh, $fn), $args);
     }
     throw StorageError::call_undefined($fn, get_class($this));
 }