public function __construct($message = null, $code = null, $previous = null, CouchData $data = null)
 {
     ob_start();
     var_dump($data->getRequest()->getData()->getData());
     $var_dump = ob_get_contents();
     ob_end_clean();
     if (is_null($message)) {
         $message = "CouchConflictException:";
     }
     $message = $message . "\n" . $var_dump;
     parent::__construct($message, $code, $previous, $data);
 }
 public function __construct(CouchDb $db, $rawData = array())
 {
     parent::__construct($rawData);
     $this->db = $db;
     // store as metadata the PHP class of this document
     $this['php_class'] = get_class($this);
 }
 /**
  * checks if the request was succesful, if not it throws a CouchException
  *
  * @return void
  * @throws CouchException The exception thrown by the server
  * @author The Young Shepherd
  **/
 protected function checkSuccess()
 {
     if (!$this->response->isSuccessful()) {
         $responseBody = CouchData::makeArray($this->response->getBody());
         $error = isset($responseBody['error']) ? $responseBody['error'] : 'Unknown';
         // camelize the error
         $error = implode('', array_map('ucfirst', explode('_', $error)));
         $class = 'Couch' . $error . 'Exception';
         if (!class_exists($class)) {
             $class = 'CouchException';
         }
         $code = $this->response->getStatus();
         $message = strtr("Received error (%status%): %error% (%reason%).", array('%status%' => $code, '%error%' => $error, '%reason%' => isset($responseBody['reason']) ? $responseBody['reason'] : 'Unknown reason'));
         throw new $class($message, $code, null, $this->getObject());
     }
 }
 public function offsetSet($key, $value)
 {
     if (is_numeric($key)) {
         $this->data['rows'][(int) $key] = $value;
     } else {
         parent::offsetSet($key, $value);
     }
 }