@@ -19,6 +19,8 @@ class Database
1919
2020 const OPTION_INCLUDE_DOCS = 'include_docs ' ;
2121 const OPTION_REDUCE = 'reduce ' ;
22+ const OPTION_DDOC = 'ddoc ' ;
23+ const OPTION_VIEW = 'view ' ;
2224
2325 /**
2426 * Constructor for the Database object - this is usually called by
@@ -179,25 +181,25 @@ public function getDocById($id) : Document
179181 public function getView ($ options = []) : array
180182 {
181183 // check we have ddoc and view name
182- if (!isset ($ options [' ddoc ' ])) {
184+ if (!isset ($ options [self :: OPTION_DDOC ])) {
183185 throw new Exception \ServerException (
184186 'ddoc is a required parameter for getView '
185187 );
186188 }
187- if (!isset ($ options [' view ' ])) {
189+ if (!isset ($ options [self :: OPTION_VIEW ])) {
188190 throw new Exception \ServerException (
189191 'view is a required parameter for getView '
190192 );
191193 }
192194
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 ];
195197
196198 // grab extra params
197199 $ query = [];
198200 foreach ($ options as $ key => $ value ) {
199201 // 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 ])) {
201203 $ query [$ key ] = $ value ;
202204 }
203205 }
0 commit comments