public function __construct($config = NULL)
 {
     if (headers_sent()) {
         throw new Exception('headers sent, cannot store');
     }
     $cookiejar = $this;
     ob_start(function ($output) use($cookiejar) {
         $cookiejar->__write();
         return $output;
     });
     $this->ob = TRUE;
     $config = $config instanceof Iface ? $config : new KVP($config);
     if (!isset($config->name)) {
         $config->name = md5(get_class($this));
     }
     if (!isset($config->path)) {
         $config->path = '/';
     }
     if (!$config->serializer instanceof Serialize\Iface) {
         if (!$config->secret) {
             throw new Exception('no secret specified', $config);
         }
         $config->serializer = new Serialize\SignBase64($config->secret);
     }
     $this->config = $config;
     $key = $config->name;
     $v = isset($_COOKIE[$key]) ? $_COOKIE[$key] : NULL;
     $this->checksum = sha1($v);
     $data = $config->serializer->unserialize($v);
     parent::__construct(new Container($data));
 }
 public function __construct(Iface $core, $secret)
 {
     $this->s = new SignBase64($secret);
     parent::__construct($core);
 }
 /**
  * Instantiate the couchbase object. pass in a set of named params.
  * Example:
  *      $cb = new Couchbase( array(
  *                      'app'       => 'myapp',
  *                      'rest'      => 'http://127.0.0.1:8092/default/',
  *                      'socket'    => '127.0.0.1:11211',
  *              ));
  */
 public function __construct(array $params)
 {
     if (!isset($params['app'])) {
         $params['app'] = '';
     }
     $app = isset($params['app']) ? trim($params['app'], '/ ') : '';
     if (strlen($app) > 0) {
         $app = $app . '/';
     }
     if (!isset($params['rest'])) {
         $params['rest'] = '';
     }
     $core = isset($params['socket']) ? $params['socket'] : NULL;
     if (!$core instanceof Memcache) {
         $core = new Memcache($core);
     }
     $core = new Prefix(new Serialize($core, new Json('')), $app);
     $this->view = new CouchbaseView($params['rest'], $app);
     parent::__construct($core);
 }