@@ -19,6 +19,8 @@ class Database
19
19
20
20
const OPTION_INCLUDE_DOCS = 'include_docs ' ;
21
21
const OPTION_REDUCE = 'reduce ' ;
22
+ const OPTION_DDOC = 'ddoc ' ;
23
+ const OPTION_VIEW = 'view ' ;
22
24
23
25
/**
24
26
* Constructor for the Database object - this is usually called by
@@ -179,25 +181,25 @@ public function getDocById($id) : Document
179
181
public function getView ($ options = []) : array
180
182
{
181
183
// check we have ddoc and view name
182
- if (!isset ($ options [' ddoc ' ])) {
184
+ if (!isset ($ options [self :: OPTION_DDOC ])) {
183
185
throw new Exception \ServerException (
184
186
'ddoc is a required parameter for getView '
185
187
);
186
188
}
187
- if (!isset ($ options [' view ' ])) {
189
+ if (!isset ($ options [self :: OPTION_VIEW ])) {
188
190
throw new Exception \ServerException (
189
191
'view is a required parameter for getView '
190
192
);
191
193
}
192
194
193
- $ endpoint = "/ " . $ this ->db_name . "/_design/ " . $ options [' ddoc ' ]
194
- . "/_view/ " . $ options [' view ' ];
195
+ $ endpoint = "/ " . $ this ->db_name . "/_design/ " . $ options [self :: OPTION_DDOC ]
196
+ . "/_view/ " . $ options [self :: OPTION_VIEW ];
195
197
196
198
// grab extra params
197
199
$ query = [];
198
200
foreach ($ options as $ key => $ value ) {
199
201
// skip the values we need for the URL, pass the rest through
200
- if (!in_array ($ key , [" ddoc " , " view " ])) {
202
+ if (!in_array ($ key , [self :: OPTION_DDOC , self :: OPTION_VIEW ])) {
201
203
$ query [$ key ] = $ value ;
202
204
}
203
205
}
0 commit comments