WpOrg\Requests
Session::merge_request()
Merge a request's data with the default data
Method of the class: Session{}
No Hooks.
Return
Array
. Request data
Usage
// protected - for code of main (parent) or child class $result = $this->merge_request( $request, $merge_options );
- $request(array) (required)
- Request data (same form as \WpOrg\Requests\Session::request_multiple())
- $merge_options(true|false)
- Should we merge options as well?
Default: true
Session::merge_request() Session::merge request code WP 6.6.2
protected function merge_request($request, $merge_options = true) { if ($this->url !== null) { $request['url'] = Iri::absolutize($this->url, $request['url']); $request['url'] = $request['url']->uri; } if (empty($request['headers'])) { $request['headers'] = []; } $request['headers'] = array_merge($this->headers, $request['headers']); if (empty($request['data'])) { if (is_array($this->data)) { $request['data'] = $this->data; } } elseif (is_array($request['data']) && is_array($this->data)) { $request['data'] = array_merge($this->data, $request['data']); } if ($merge_options === true) { $request['options'] = array_merge($this->options, $request['options']); // Disallow forcing the type, as that's a per request setting unset($request['options']['type']); } return $request; }