@@ -189,6 +189,9 @@ |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | |
| 192 | + /** |
|
| 193 | + * @param string $value |
|
| 194 | + */ |
|
| 192 | 195 | public function setLanguage($value) { |
| 193 | 196 | if (!empty($value)) |
| 194 | 197 | $this->meta['language'] = strtolower((string)$value); |
@@ -162,6 +162,11 @@ discard block |
||
| 162 | 162 | /* |
| 163 | 163 | * Public API, convert a UUID from one format to another |
| 164 | 164 | */ |
| 165 | + |
|
| 166 | + /** |
|
| 167 | + * @param integer $from |
|
| 168 | + * @param integer $to |
|
| 169 | + */ |
|
| 165 | 170 | static public function convert($uuid, $from, $to) { |
| 166 | 171 | $conv = self::$m_convert[$from][$to]; |
| 167 | 172 | if (!isset($conv)) |
@@ -189,6 +194,11 @@ discard block |
||
| 189 | 194 | /* |
| 190 | 195 | * Generate UUID version 3 and 5 (name based) |
| 191 | 196 | */ |
| 197 | + |
|
| 198 | + /** |
|
| 199 | + * @param string $hash |
|
| 200 | + * @param integer $version |
|
| 201 | + */ |
|
| 192 | 202 | static private function generateName($ns, $node, $hash, $version) { |
| 193 | 203 | $ns_fmt = self::detectFormat($ns); |
| 194 | 204 | $field = self::convert($ns, $ns_fmt, self::FMT_FIELD); |
@@ -67,29 +67,29 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | class UUID { |
| 69 | 69 | /* UUID versions */ |
| 70 | - const UUID_TIME = 1; /* Time based UUID */ |
|
| 71 | - const UUID_NAME_MD5 = 3; /* Name based (MD5) UUID */ |
|
| 72 | - const UUID_RANDOM = 4; /* Random UUID */ |
|
| 73 | - const UUID_NAME_SHA1 = 5; /* Name based (SHA1) UUID */ |
|
| 70 | + const UUID_TIME = 1; /* Time based UUID */ |
|
| 71 | + const UUID_NAME_MD5 = 3; /* Name based (MD5) UUID */ |
|
| 72 | + const UUID_RANDOM = 4; /* Random UUID */ |
|
| 73 | + const UUID_NAME_SHA1 = 5; /* Name based (SHA1) UUID */ |
|
| 74 | 74 | |
| 75 | 75 | /* UUID formats */ |
| 76 | 76 | const FMT_FIELD = 100; |
| 77 | 77 | const FMT_STRING = 101; |
| 78 | 78 | const FMT_BINARY = 102; |
| 79 | - const FMT_QWORD = 1; /* Quad-word, 128-bit (not impl.) */ |
|
| 80 | - const FMT_DWORD = 2; /* Double-word, 64-bit (not impl.) */ |
|
| 81 | - const FMT_WORD = 4; /* Word, 32-bit (not impl.) */ |
|
| 82 | - const FMT_SHORT = 8; /* Short (not impl.) */ |
|
| 83 | - const FMT_BYTE = 16; /* Byte */ |
|
| 84 | - const FMT_DEFAULT = 16; |
|
| 79 | + const FMT_QWORD = 1; /* Quad-word, 128-bit (not impl.) */ |
|
| 80 | + const FMT_DWORD = 2; /* Double-word, 64-bit (not impl.) */ |
|
| 81 | + const FMT_WORD = 4; /* Word, 32-bit (not impl.) */ |
|
| 82 | + const FMT_SHORT = 8; /* Short (not impl.) */ |
|
| 83 | + const FMT_BYTE = 16; /* Byte */ |
|
| 84 | + const FMT_DEFAULT = 16; |
|
| 85 | 85 | |
| 86 | 86 | /* Field UUID representation */ |
| 87 | 87 | static private $m_uuid_field = array( |
| 88 | - 'time_low' => 0, /* 32-bit */ |
|
| 89 | - 'time_mid' => 0, /* 16-bit */ |
|
| 90 | - 'time_hi' => 0, /* 16-bit */ |
|
| 91 | - 'clock_seq_hi' => 0, /* 8-bit */ |
|
| 92 | - 'clock_seq_low' => 0, /* 8-bit */ |
|
| 88 | + 'time_low' => 0, /* 32-bit */ |
|
| 89 | + 'time_mid' => 0, /* 16-bit */ |
|
| 90 | + 'time_hi' => 0, /* 16-bit */ |
|
| 91 | + 'clock_seq_hi' => 0, /* 8-bit */ |
|
| 92 | + 'clock_seq_low' => 0, /* 8-bit */ |
|
| 93 | 93 | 'node' => array() /* 48-bit */ |
| 94 | 94 | ); |
| 95 | 95 | |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | $uuid[9] = $src['clock_seq_low']; |
| 285 | 285 | |
| 286 | 286 | for ($i = 0; $i < 6; $i++) |
| 287 | - $uuid[10+$i] = $src['node'][$i]; |
|
| 287 | + $uuid[10 + $i] = $src['node'][$i]; |
|
| 288 | 288 | |
| 289 | 289 | return ($uuid); |
| 290 | 290 | } |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | $field['clock_seq_low'] = $uuid[9]; |
| 315 | 315 | |
| 316 | 316 | for ($i = 0; $i < 6; $i++) |
| 317 | - $field['node'][$i] = $uuid[10+$i]; |
|
| 317 | + $field['node'][$i] = $uuid[10 + $i]; |
|
| 318 | 318 | return ($field); |
| 319 | 319 | } |
| 320 | 320 | |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | $field['clock_seq_hi'] = ($parts[3] & 0xff00) >> 8; |
| 340 | 340 | $field['clock_seq_low'] = $parts[3] & 0x00ff; |
| 341 | 341 | for ($i = 0; $i < 6; $i++) |
| 342 | - $field['node'][$i] = $parts[4+$i]; |
|
| 342 | + $field['node'][$i] = $parts[4 + $i]; |
|
| 343 | 343 | |
| 344 | 344 | return ($field); |
| 345 | 345 | } |
@@ -54,6 +54,7 @@ |
||
| 54 | 54 | * @brief Converts the given JSON into an array. |
| 55 | 55 | * @param[in] string $json A JSON object. |
| 56 | 56 | * @param[in] bool $assoc When `true`, returned objects will be converted into associative arrays. |
| 57 | + * @param boolean $assoc |
|
| 57 | 58 | * @retval array |
| 58 | 59 | */ |
| 59 | 60 | public static function fromJson($json, $assoc) { |
@@ -266,6 +266,7 @@ discard block |
||
| 266 | 266 | * @param[in] string $path The absolute path of the request. |
| 267 | 267 | * @param[in] string $queryParams (optional) Associative array of query parameters. |
| 268 | 268 | * @param[in] string $headerFields (optional) Associative array of header fields. |
| 269 | + * @param string $path |
|
| 269 | 270 | */ |
| 270 | 271 | public function __construct($method, $path, array $queryParams = NULL, array $headerFields = NULL) { |
| 271 | 272 | parent::__construct(); |
@@ -419,6 +420,8 @@ discard block |
||
| 419 | 420 | * @brief This helper forces request to use the Authorization Basic mode. |
| 420 | 421 | * @param[in] string $userName User name. |
| 421 | 422 | * @param[in] string $password Password. |
| 423 | + * @param string $userName |
|
| 424 | + * @param string $password |
|
| 422 | 425 | */ |
| 423 | 426 | public function setBasicAuth($userName, $password) { |
| 424 | 427 | $this->setHeaderField(self::AUTHORIZATION_HF, "Basic ".base64_encode("$userName:$password")); |
@@ -189,9 +189,9 @@ discard block |
||
| 189 | 189 | */ |
| 190 | 190 | const X_FORWARDED_FOR_HF = "X-Forwarded-For"; |
| 191 | 191 | |
| 192 | - const DESTINATION_HF = "Destination"; //!< This header field is not supported by HTTP 1.1. It's a special header field used by CouchDB. |
|
| 193 | - const X_COUCHDB_WWW_AUTHENTICATE_HF = "X-CouchDB-WWW-Authenticate"; //!< This header field is not supported by HTTP 1.1. It's a special method header field by CouchDB. |
|
| 194 | - const X_COUCHDB_FULL_COMMIT_HF = "X-Couch-Full-Commit"; //!< This header field is not supported by HTTP 1.1. It's a special header field used by CouchDB. |
|
| 192 | + const DESTINATION_HF = "Destination"; //!< This header field is not supported by HTTP 1.1. It's a special header field used by CouchDB. |
|
| 193 | + const X_COUCHDB_WWW_AUTHENTICATE_HF = "X-CouchDB-WWW-Authenticate"; //!< This header field is not supported by HTTP 1.1. It's a special method header field by CouchDB. |
|
| 194 | + const X_COUCHDB_FULL_COMMIT_HF = "X-Couch-Full-Commit"; //!< This header field is not supported by HTTP 1.1. It's a special header field used by CouchDB. |
|
| 195 | 195 | |
| 196 | 196 | //!@} |
| 197 | 197 | |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | $params = explode('&', $query); |
| 409 | 409 | |
| 410 | 410 | foreach ($params as $param) { |
| 411 | - @list($name, $value) = explode('=', $param, 2); |
|
| 411 | + @list($name, $value) = explode('=', $param, 2); |
|
| 412 | 412 | $this->setQueryParam($name, $value); |
| 413 | 413 | } |
| 414 | 414 | } |
@@ -100,8 +100,8 @@ |
||
| 100 | 100 | $buffer .= "File Opened Since: ".sprintf($since, $time['days'], $time['hours'], $time['minutes'], $time['seconds']).PHP_EOL; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $buffer .= "Disk Size: ".round($this->diskSize/(1024*1024*1024), 3)." GB".PHP_EOL; |
|
| 104 | - $buffer .= "Data Size: ".round($this->dataSize/(1024*1024*1024), 3)." GB".PHP_EOL; |
|
| 103 | + $buffer .= "Disk Size: ".round($this->diskSize / (1024 * 1024 * 1024), 3)." GB".PHP_EOL; |
|
| 104 | + $buffer .= "Data Size: ".round($this->dataSize / (1024 * 1024 * 1024), 3)." GB".PHP_EOL; |
|
| 105 | 105 | $buffer .= "Disk Format Version: ".$this->diskFormatVersion.PHP_EOL; |
| 106 | 106 | |
| 107 | 107 | $compactRunning = ($this->compactRunning) ? 'active' : 'inactive'; |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | //!@{ |
| 36 | 36 | |
| 37 | 37 | const STD_DOC_PATH = ""; //!< Path for standard documents. |
| 38 | - const LOCAL_DOC_PATH = "_local/"; //!< Path for local documents. |
|
| 39 | - const DESIGN_DOC_PATH = "_design/"; //!< Path for design documents. |
|
| 38 | + const LOCAL_DOC_PATH = "_local/"; //!< Path for local documents. |
|
| 39 | + const DESIGN_DOC_PATH = "_design/"; //!< Path for design documents. |
|
| 40 | 40 | |
| 41 | 41 | //!@} |
| 42 | 42 | |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | public function cleanupViews() { |
| 784 | 784 | $this->checkForDb(); |
| 785 | 785 | |
| 786 | - $request = new Request(Request::POST_METHOD, "/".$this->dbName."/_view_cleanup"); |
|
| 786 | + $request = new Request(Request::POST_METHOD, "/".$this->dbName."/_view_cleanup"); |
|
| 787 | 787 | |
| 788 | 788 | // A POST method requires Content-Type header. |
| 789 | 789 | $request->setHeaderField(Request::CONTENT_TYPE_HF, "application/json"); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * arrays. |
| 55 | 55 | * @retval array An array of rows. |
| 56 | 56 | */ |
| 57 | - public function asArray() { |
|
| 57 | + public function asArray() { |
|
| 58 | 58 | return $this->result['rows']; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * @param[in] integer $offset The offset to retrieve. |
| 106 | 106 | * @retval mixed Can return all value types. |
| 107 | 107 | */ |
| 108 | - public function offsetGet($offset) { |
|
| 108 | + public function offsetGet($offset) { |
|
| 109 | 109 | return $this->result['rows'][$offset]; |
| 110 | 110 | } |
| 111 | 111 | |