@@ -78,37 +78,19 @@ public function getLastResponse()
7878 return $ this ->lastResponse ;
7979 }
8080
81- public function send (Request $ request , array $ params = [] )
81+ public function send (Request $ request , array $ params = array () )
8282 {
83- $ args = [];
84-
85- if (! empty ($ params )) {
86- if ($ request ->getMethod () === 'GET ' ) {
87- $ args ['query ' ] = $ params ;
88- } else {
89- $ args ['json ' ] = $ params ;
90- }
83+ $ args = array ();
84+ if ($ request ->getMethod () === 'GET ' ) {
85+ $ args ['query ' ] = $ params ;
86+ } else {
87+ $ args ['json ' ] = $ params ;
9188 }
92-
93- //Load the response in a variable
9489 $ this ->lastResponse = $ this ->client ->send ($ request , $ args );
95-
96- //Decode the json string and save to a varibale.
97- //We do need return this derict so we can check for an json error.
98- $ return = json_decode (
90+ return json_decode (
9991 $ this ->lastResponse ->getBody ()->getContents (),
10092 true
10193 );
102-
103- //Check if there are any json error.
104- //if there is an error throw an exeption
105- //TOD: make costum exeption.
106- $ json_error = json_last_error ();
107- if ($ json_error === JSON_ERROR_NONE ) {
108- return $ return ;
109- } else {
110- throw new Exception ($ json_error );
111- }
11294 }
11395
11496 public function createObject ($ className , $ data )
0 commit comments