Example #1
0
 /**
  * Get a user
  *
  * @param string $username 
  * @param string $json 
  * @return array
  * @author Adam Venturella
  * @example ../samples/users/user_info.php Get info on a user
  */
 public function user($username, $json = false)
 {
     $connection = new CouchDBConnection($this->connectionOptions);
     $response = $connection->execute(new View('users', '_auth/users', array('key' => $username)));
     if ($json) {
         return $response->data;
     } else {
         $view = CouchDBView::viewWithJSON($response->data);
         return $view[0]['value'];
     }
 }
Example #2
0
 /**
  * undocumented function
  *
  * @param string $json 
  * @return void
  * @author Adam Venturella
  */
 public static function viewWithJSON($json)
 {
     $view = new CouchDBView();
     $view->setJSON($json);
     return $view;
 }