1515 * limitations under the License.
1616*/
1717
18+ namespace QuickBase {
19+
1820class QuickBase {
1921
2022 private $ defaults = array (
@@ -74,7 +76,7 @@ final public function api($action, $options = array()){
7476
7577}
7678
77- class QuickBaseError extends Exception {
79+ class QuickBaseError extends \ Exception {
7880
7981 protected $ details ;
8082
@@ -125,15 +127,15 @@ public function __construct(&$parent, $action = '', $options = array()){
125127 }
126128
127129 final public function actionRequest (){
128- if (method_exists ('QuickBaseRequest ' , $ this ->action )){
130+ if (method_exists ('\QuickBase\ QuickBaseRequest ' , $ this ->action )){
129131 QuickBaseRequest::{$ this ->action }($ this );
130132 }
131133
132134 return $ this ;
133135 }
134136
135137 final public function actionResponse (){
136- if (method_exists ('QuickBaseResponse ' , $ this ->action )){
138+ if (method_exists ('\QuickBase\ QuickBaseResponse ' , $ this ->action )){
137139 QuickBaseResponse::{$ this ->action }($ this , $ this ->response );
138140 }
139141
@@ -168,7 +170,7 @@ final public function constructPayload(){
168170 $ this ->payload = '' ;
169171
170172 if ($ this ->settings ['flags ' ]['useXML ' ]){
171- $ xmlDoc = new SimpleXMLElement (implode ('' , array (
173+ $ xmlDoc = new \ SimpleXMLElement (implode ('' , array (
172174 '<?xml version="1.0" encoding=" ' ,
173175 $ this ->options ['encoding ' ],
174176 '"?> ' ,
@@ -192,7 +194,7 @@ final public function constructPayload(){
192194 }
193195
194196 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 ' ]){
196198 ++$ this ->nErrors ;
197199
198200 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(){
234236 }
235237
236238 foreach ($ this ->options as $ key => $ value ){
237- if (method_exists ('QuickBaseOption ' , $ key )){
239+ if (method_exists ('\QuickBase\ QuickBaseOption ' , $ key )){
238240 $ this ->options [$ key ] = QuickBaseOption::{$ key }($ value );
239241 }
240242 }
@@ -302,7 +304,7 @@ final public function transmit(){
302304 if ($ headers ['Content-Type ' ] === 'application/xml ' ){
303305 $ this ->response = array ();
304306
305- $ xml = new SimpleXmlIterator ($ body );
307+ $ xml = new \ SimpleXmlIterator ($ body );
306308
307309 $ this ->xml2Arr ($ xml , $ this ->response );
308310
@@ -316,7 +318,7 @@ final public function transmit(){
316318
317319 /* Helpers */
318320 final public static function arr2Obj (&$ arr , $ return = false ){
319- $ obj = new stdClass ;
321+ $ obj = new \ stdClass ;
320322
321323 foreach ($ arr as $ key => $ val ){
322324 if (!empty ($ key )){
@@ -1228,4 +1230,6 @@ final public static function slist($val){
12281230
12291231}
12301232
1233+ } // End QuickBase Namespace
1234+
12311235?>
0 commit comments