File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -379,6 +379,27 @@ private function tokens($data=array()) {
379379 }
380380
381381
382+ function _array_to_obj ($ array , &$ obj )
383+ {
384+ foreach ($ array as $ key => $ value )
385+ {
386+ if (is_array ($ value )) {
387+ $ obj ->$ key = new stdClass ();
388+ $ this ->_array_to_obj ($ value , $ obj ->$ key );
389+ } else {
390+ $ obj ->$ key = $ value ;
391+ }
392+ }
393+ return $ obj ;
394+ }
395+
396+ function arrayToObject ($ array )
397+ {
398+ $ object = new stdClass ();
399+ return $ this ->_array_to_obj ($ array ,$ object );
400+ }
401+
402+
382403 /**
383404 * API GET request
384405 *
@@ -390,7 +411,7 @@ private function tokens($data=array()) {
390411 final public function get ($ path , $ data =array ()) {
391412 if ($ data ) $ path .= '/? ' . http_build_query ($ data );
392413 if ($ response = $ this ->api ($ path )) {
393- return $ response ;
414+ return $ this -> arrayToObject ( $ response) ;
394415 } else {
395416 return false ;
396417 }
You can’t perform that action at this time.
0 commit comments