/**
* Normalizes cookies for using in Requests.
*
* @since 4.6.0
*
* @param array $cookies Array of cookies to send with the request.
* @return WpOrg\Requests\Cookie\Jar Cookie holder object.
*/
public static function normalize_cookies( $cookies ) { $cookie_jar =
new WpOrg\Requests\Cookie\
Jar();
foreach ( $cookies as $name =>
$value ) { if ( $value instanceof WP_Http_Cookie
) { $attributes =
array_filter( $value->
get_attributes(),
static function( $attr ) { return null !==
$attr;
} );
$cookie_jar[ $value->name
] =
new WpOrg\Requests\
Cookie( $value->name,
$value->value,
$attributes, array
( 'host-only' =>
$value->host_only
) );
} elseif ( is_scalar( $value ) ) {