@@ -164,6 +164,14 @@ public function getDocById($id) : Document
164
164
}
165
165
}
166
166
167
+ /**
168
+ * Get data from a view, either docs or grouped data
169
+ *
170
+ * @param array $options Must include `ddoc` and `view`, also suppoerts any
171
+ * other query parameters that should be passed to the view (e.g. limit)
172
+ * @return array If there are documents, an array of \PHPCouchDB\Document
173
+ * objects, otherwise an array as appropriate
174
+ */
167
175
public function getView ($ options = []) : array
168
176
{
169
177
// check we have ddoc and view name
@@ -210,6 +218,18 @@ public function getView($options = []) : array
210
218
return $ data ;
211
219
}
212
220
221
+ /**
222
+ * Take a result set, work out if it contains docs, doc tombstones, or
223
+ * data that we shouldn't mess with, and return \Document objects or arrays
224
+ * as appropriate
225
+ *
226
+ * @param \GuzzleHttp\Message\ResponseInterface $response What we got back
227
+ * from making a Guzzle request to the CouchDB server
228
+ * @return array An array whose contents depends on the response content:
229
+ * - an array of full CouchDB docs: returns array of \PHPCouchDB\Document
230
+ * - an array of id/rev pairs from docs: returns an array of arrays containing id/rev
231
+ * - an array of anything else: returns it just as an array
232
+ */
213
233
protected function handleServerResponse ($ response ) : array
214
234
{
215
235
if ($ response ->getStatusCode () == 200 ) {
@@ -247,9 +267,9 @@ protected function handleServerResponse($response) : array
247
267
* Guzzle doesn't send booleans as words
248
268
*
249
269
* @param mixed $value The value to use
250
- * @return A string either "true" or "false"
270
+ * @return string A string either "true" or "false"
251
271
*/
252
- protected function boolToString ($ value )
272
+ protected function boolToString ($ value ) : string
253
273
{
254
274
if ($ value ) {
255
275
return "true " ;
0 commit comments