@@ -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 | } |
@@ -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 | |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | * @see http://docs.couchdb.org/en/latest/api/database/compact.html#db-view-cleanup |
| 663 | 663 | */ |
| 664 | 664 | public function cleanupViews($dbName) { |
| 665 | - $request = new Request(Request::POST_METHOD, "/".rawurlencode($this->prefix.$dbName)."/_view_cleanup"); |
|
| 665 | + $request = new Request(Request::POST_METHOD, "/".rawurlencode($this->prefix.$dbName)."/_view_cleanup"); |
|
| 666 | 666 | |
| 667 | 667 | // A POST method requires Content-Type header. |
| 668 | 668 | $request->setHeaderField(Request::CONTENT_TYPE_HF, "application/json"); |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | |
| 298 | 298 | /** |
| 299 | 299 | * @brief Returns a list of all database events in the CouchDB instance. |
| 300 | - * @param DbUpdatesFeedOpts $opts Additional options. |
|
| 300 | + * @param Opt\DbUpdatesFeedOpts $opts Additional options. |
|
| 301 | 301 | * @return Response |
| 302 | 302 | * @attention Requires admin privileges. |
| 303 | 303 | * @see http://docs.couchdb.org/en/latest/api/server/common.html#db-updates |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | * @brief Obtains a list of the changes made to the database. This can be used to monitor for update and modifications |
| 578 | 578 | * to the database for post processing or synchronization. |
| 579 | 579 | * @param string $name The database name. |
| 580 | - * @param ChangesFeedOpts $opts Additional options. |
|
| 580 | + * @param Opt\ChangesFeedOpts $opts Additional options. |
|
| 581 | 581 | * @return Response |
| 582 | 582 | * @see http://docs.couchdb.org/en/latest/api/database/changes.html |
| 583 | 583 | */ |
@@ -708,7 +708,7 @@ discard block |
||
| 708 | 708 | /** |
| 709 | 709 | * @brief Returns the special security object for the database. |
| 710 | 710 | * @param string $dbName The database name. |
| 711 | - * @return string A JSON object. |
|
| 711 | + * @return Response A JSON object. |
|
| 712 | 712 | * @see http://docs.couchdb.org/en/latest/api/database/security.html#get--db-_security |
| 713 | 713 | */ |
| 714 | 714 | public function getSecurityObj($dbName) { |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | * permanent continuous replications that survive a server restart without you having to do anything. |
| 763 | 763 | * @param string|array $filter (optional) Name of a filter function that can choose which revisions get replicated. |
| 764 | 764 | * You can also provide an array of document identifiers; if given, only these documents will be replicated. |
| 765 | - * @param ViewQueryOpts $opts (optional) Query options to get additional information, grouping results, include |
|
| 765 | + * @param Opt\ViewQueryOpts $opts (optional) Query options to get additional information, grouping results, include |
|
| 766 | 766 | * docs, etc. |
| 767 | 767 | * @return Response |
| 768 | 768 | * @see http://docs.couchdb.org/en/latest/api/server/common.html#post--_replicate |
@@ -866,7 +866,7 @@ discard block |
||
| 866 | 866 | * @param array $keys (optional) Used to retrieve just the view rows matching that set of keys. Rows are returned |
| 867 | 867 | * in the order of the specified keys. Combining this feature with Opt\ViewQueryOpts.includeDocs() results in the so-called |
| 868 | 868 | * multi-document-fetch feature. |
| 869 | - * @param ViewQueryOpts $opts (optional) Query options to get additional information, grouping results, include |
|
| 869 | + * @param Opt\ViewQueryOpts $opts (optional) Query options to get additional information, grouping results, include |
|
| 870 | 870 | * docs, etc. |
| 871 | 871 | * @param ChunkHook $chunkHook (optional) A class instance that implements the IChunkHook interface. |
| 872 | 872 | * @return Result::QueryResult The result of the query. |
@@ -898,7 +898,7 @@ discard block |
||
| 898 | 898 | * @param array $keys (optional) Used to retrieve just the view rows matching that set of keys. Rows are returned |
| 899 | 899 | * in the order of the specified keys. Combining this feature with Opt\ViewQueryOpts.includeDocs() results in the so-called |
| 900 | 900 | * multi-document-fetch feature. |
| 901 | - * @param ViewQueryOpts $opts (optional) Query options to get additional information, grouping results, include |
|
| 901 | + * @param Opt\ViewQueryOpts $opts (optional) Query options to get additional information, grouping results, include |
|
| 902 | 902 | * docs, etc. |
| 903 | 903 | * @param IChunkHook $chunkHook (optional) A class instance that implements the IChunkHook interface. |
| 904 | 904 | * @return Result::QueryResult The result of the query. |
@@ -950,7 +950,7 @@ discard block |
||
| 950 | 950 | * @param array $keys (optional) Used to retrieve just the view rows matching that set of keys. Rows are returned |
| 951 | 951 | * in the order of the specified keys. Combining this feature with Opt\ViewQueryOpts.includeDocs() results in the so-called |
| 952 | 952 | * multi-document-fetch feature. |
| 953 | - * @param ViewQueryOpts $opts (optional) Query options to get additional information, grouping results, include |
|
| 953 | + * @param Opt\ViewQueryOpts $opts (optional) Query options to get additional information, grouping results, include |
|
| 954 | 954 | * docs, etc. |
| 955 | 955 | * @param string $language The language used to implement the map and reduce functions. |
| 956 | 956 | * @param IChunkHook $chunkHook (optional) A class instance that implements the IChunkHook interface. |
@@ -1090,7 +1090,7 @@ discard block |
||
| 1090 | 1090 | * @param string $docId The document's identifier. |
| 1091 | 1091 | * @param string $path The document's path. |
| 1092 | 1092 | * @param string $rev (optional) The document's revision. |
| 1093 | - * @param DocOpts $opts Query options to get additional document information, like conflicts, attachments, etc. |
|
| 1093 | + * @param Opt\DocOpts $opts Query options to get additional document information, like conflicts, attachments, etc. |
|
| 1094 | 1094 | * @return object|Response An instance of Doc, LocalDoc, DesignDoc or any subclass of Doc. |
| 1095 | 1095 | * @see http://docs.couchdb.org/en/latest/api/document/common.html#get--db-docid |
| 1096 | 1096 | */ |
@@ -1145,7 +1145,7 @@ discard block |
||
| 1145 | 1145 | * using PUT instead we need to specify one. We can still use the function getUuids() to ask CouchDB for some ids. |
| 1146 | 1146 | * This is an internal detail. You have only to know that CouchDB can generate the document id for you. |
| 1147 | 1147 | * @param string $dbName The database name. |
| 1148 | - * @param Doc $doc The document you want insert or update. |
|
| 1148 | + * @param Doc\IDoc $doc The document you want insert or update. |
|
| 1149 | 1149 | * @param bool $batchMode (optional) You can write documents to the database at a higher rate by using the batch |
| 1150 | 1150 | * option. This collects document writes together in memory (on a user-by-user basis) before they are committed to |
| 1151 | 1151 | * disk. This increases the risk of the documents not being stored in the event of a failure, since the documents are |
@@ -1334,7 +1334,7 @@ discard block |
||
| 1334 | 1334 | * @param string $docId The document's identifier. |
| 1335 | 1335 | * @param string $path The document's path. |
| 1336 | 1336 | * @param string $rev (optional) The document's revision. |
| 1337 | - * @return string The document's revision. |
|
| 1337 | + * @return Response The document's revision. |
|
| 1338 | 1338 | * @see http://docs.couchdb.org/en/latest/api/document/attachments.html#db-doc-attachment |
| 1339 | 1339 | */ |
| 1340 | 1340 | public function getAttachmentInfo($dbName, $fileName, $path, $docId, $rev = NULL) { |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * arrays. |
| 55 | 55 | * @return 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 integer $offset The offset to retrieve. |
| 106 | 106 | * @return 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 | |