public function __sleep() : array { // convert iterables to strings for serialization if (is_iterable($this->body)) { $this->body = $this->bodyToString(); } $this->_headers = $this->getHeaders(); return [ '_headers', 'body', 'type', 'subtype', 'parameters', ]; }