15
15
* limitations under the License.
16
16
*/
17
17
18
+ namespace QuickBase {
19
+
18
20
class QuickBase {
19
21
20
22
private $ defaults = array (
@@ -74,7 +76,7 @@ final public function api($action, $options = array()){
74
76
75
77
}
76
78
77
- class QuickBaseError extends Exception {
79
+ class QuickBaseError extends \ Exception {
78
80
79
81
protected $ details ;
80
82
@@ -125,15 +127,15 @@ public function __construct(&$parent, $action = '', $options = array()){
125
127
}
126
128
127
129
final public function actionRequest (){
128
- if (method_exists ('QuickBaseRequest ' , $ this ->action )){
130
+ if (method_exists ('\QuickBase\ QuickBaseRequest ' , $ this ->action )){
129
131
QuickBaseRequest::{$ this ->action }($ this );
130
132
}
131
133
132
134
return $ this ;
133
135
}
134
136
135
137
final public function actionResponse (){
136
- if (method_exists ('QuickBaseResponse ' , $ this ->action )){
138
+ if (method_exists ('\QuickBase\ QuickBaseResponse ' , $ this ->action )){
137
139
QuickBaseResponse::{$ this ->action }($ this , $ this ->response );
138
140
}
139
141
@@ -168,7 +170,7 @@ final public function constructPayload(){
168
170
$ this ->payload = '' ;
169
171
170
172
if ($ this ->settings ['flags ' ]['useXML ' ]){
171
- $ xmlDoc = new SimpleXMLElement (implode ('' , array (
173
+ $ xmlDoc = new \ SimpleXMLElement (implode ('' , array (
172
174
'<?xml version="1.0" encoding=" ' ,
173
175
$ this ->options ['encoding ' ],
174
176
'"?> ' ,
@@ -192,7 +194,7 @@ final public function constructPayload(){
192
194
}
193
195
194
196
final public function checkForAndHandleError (){
195
- if ($ this ->response ['errcode ' ] != $ this ->settings ['status ' ]['errcode ' ]){
197
+ if (isset ( $ this -> response [ ' errcode ' ]) && $ this ->response ['errcode ' ] != $ this ->settings ['status ' ]['errcode ' ]){
196
198
++$ this ->nErrors ;
197
199
198
200
if ($ this ->nErrors <= $ this ->parent ->settings ['maxErrorRetryAttempts ' ] && $ this ->response ['errcode ' ] == 4 && isset ($ this ->parent ->settings ['username ' ]) && isset ($ this ->parent ->settings ['password ' ])){
@@ -234,7 +236,7 @@ final public function processOptions(){
234
236
}
235
237
236
238
foreach ($ this ->options as $ key => $ value ){
237
- if (method_exists ('QuickBaseOption ' , $ key )){
239
+ if (method_exists ('\QuickBase\ QuickBaseOption ' , $ key )){
238
240
$ this ->options [$ key ] = QuickBaseOption::{$ key }($ value );
239
241
}
240
242
}
@@ -302,7 +304,7 @@ final public function transmit(){
302
304
if ($ headers ['Content-Type ' ] === 'application/xml ' ){
303
305
$ this ->response = array ();
304
306
305
- $ xml = new SimpleXmlIterator ($ body );
307
+ $ xml = new \ SimpleXmlIterator ($ body );
306
308
307
309
$ this ->xml2Arr ($ xml , $ this ->response );
308
310
@@ -316,7 +318,7 @@ final public function transmit(){
316
318
317
319
/* Helpers */
318
320
final public static function arr2Obj (&$ arr , $ return = false ){
319
- $ obj = new stdClass ;
321
+ $ obj = new \ stdClass ;
320
322
321
323
foreach ($ arr as $ key => $ val ){
322
324
if (!empty ($ key )){
@@ -1228,4 +1230,6 @@ final public static function slist($val){
1228
1230
1229
1231
}
1230
1232
1233
+ } // End QuickBase Namespace
1234
+
1231
1235
?>
0 commit comments