@@ -105,31 +105,31 @@ public function offsetUnset($key) : void {
105
105
}
106
106
107
107
// Request methods:
108
- public function get (string $ url , array | string $ parameters =[], array $ headers =[]) : RestClient {
108
+ public function get (string $ url , $ parameters =[], array $ headers =[]) : RestClient {
109
109
return $ this ->execute ($ url , 'GET ' , $ parameters , $ headers );
110
110
}
111
111
112
- public function post (string $ url , array | string $ parameters =[], array $ headers =[]) : RestClient {
112
+ public function post (string $ url , $ parameters =[], array $ headers =[]) : RestClient {
113
113
return $ this ->execute ($ url , 'POST ' , $ parameters , $ headers );
114
114
}
115
115
116
- public function put (string $ url , array | string $ parameters =[], array $ headers =[]) : RestClient {
116
+ public function put (string $ url , $ parameters =[], array $ headers =[]) : RestClient {
117
117
return $ this ->execute ($ url , 'PUT ' , $ parameters , $ headers );
118
118
}
119
119
120
- public function patch (string $ url , array | string $ parameters =[], array $ headers =[]) : RestClient {
120
+ public function patch (string $ url , $ parameters =[], array $ headers =[]) : RestClient {
121
121
return $ this ->execute ($ url , 'PATCH ' , $ parameters , $ headers );
122
122
}
123
123
124
- public function delete (string $ url , array | string $ parameters =[], array $ headers =[]) : RestClient {
124
+ public function delete (string $ url , $ parameters =[], array $ headers =[]) : RestClient {
125
125
return $ this ->execute ($ url , 'DELETE ' , $ parameters , $ headers );
126
126
}
127
127
128
- public function head (string $ url , array | string $ parameters =[], array $ headers =[]) : RestClient {
128
+ public function head (string $ url , $ parameters =[], array $ headers =[]) : RestClient {
129
129
return $ this ->execute ($ url , 'HEAD ' , $ parameters , $ headers );
130
130
}
131
131
132
- public function execute (string $ url , string $ method ='GET ' , array | string $ parameters =[], array $ headers =[]) : RestClient {
132
+ public function execute (string $ url , string $ method ='GET ' , $ parameters =[], array $ headers =[]) : RestClient {
133
133
$ client = clone $ this ;
134
134
$ client ->url = $ url ;
135
135
$ client ->handle = curl_init ();
@@ -187,7 +187,7 @@ public function execute(string $url, string $method='GET', array|string $paramet
187
187
}
188
188
189
189
if ($ client ->options ['base_url ' ]){
190
- if ($ client ->url [0 ] !== '/ ' && ! str_ends_with ($ client ->options ['base_url ' ], '/ ' ) )
190
+ if ($ client ->url [0 ] !== '/ ' && substr ($ client ->options ['base_url ' ], - 1 ) !== '/ ' )
191
191
$ client ->url = '/ ' . $ client ->url ;
192
192
$ client ->url = $ client ->options ['base_url ' ] . $ client ->url ;
193
193
}
@@ -218,7 +218,7 @@ public function parse_response($response) : void {
218
218
// Since we tokenize on \n, use the remaining \r to detect empty lines.
219
219
if (count ($ headers ) > 0 ) break ; // Must be the newline after headers, move on to response body
220
220
}
221
- elseif (str_starts_with ($ line , 'HTTP ' )){
221
+ elseif (strpos ($ line , 'HTTP ' ) === 0 ){
222
222
// One or more HTTP status lines
223
223
$ this ->response_status_lines [] = trim ($ line );
224
224
}
@@ -259,7 +259,7 @@ public function get_response_format() : string {
259
259
"Response format could not be determined. " );
260
260
}
261
261
262
- public function decode_response () : mixed {
262
+ public function decode_response (){
263
263
if (empty ($ this ->decoded_response )){
264
264
$ format = $ this ->get_response_format ();
265
265
if (!array_key_exists ($ format , $ this ->options ['decoders ' ]))
0 commit comments