public function write($data = null) {
		if (!is_resource($this->_resource)) {
			return false;
		}
		if (!is_object($data)) {
			$data = $this->_instance($this->_classes['request'], (array) $data + $this->_config);
		}
		$this->set(CURLOPT_URL, $data->to('url'));

		if ($data instanceof Message) {
			if (!empty($this->_config['ignoreExpect'])) {
				$data->headers('Expect', ' ');
			}
			if (isset($data->headers)) {
				$this->set(CURLOPT_HTTPHEADER, $data->headers());
			}
			if (isset($data->method) && $data->method === 'POST') {
				$this->set([CURLOPT_POST => true, CURLOPT_POSTFIELDS => $data->body()]);
			}
			if (isset($data->method) && in_array($data->method,['PUT','PATCH','DELETE'])) {
				$this->set([
					CURLOPT_CUSTOMREQUEST => $data->method,
					CURLOPT_POSTFIELDS => $data->body()
				]);
			}
		}
		return (boolean) curl_setopt_array($this->_resource, $this->options);
	}
public function write($data = null) {
		if (!is_resource($this->_resource)) {
			return false;
		}
		if (!is_object($data)) {
			$data = $this->_instance($this->_classes['request'], (array) $data + $this->_config);
		}
		$this->set(CURLOPT_URL, $data->to('url'));

		if ($data instanceof Message) {
			if (!empty($this->_config['ignoreExpect'])) {
				$data->headers('Expect', ' ');
			}
			if (isset($data->headers)) {
				$this->set(CURLOPT_HTTPHEADER, $data->headers());
			}
			if (isset($data->method) && $data->method === 'POST') {
				$this->set([CURLOPT_POST => true, CURLOPT_POSTFIELDS => $data->body()]);
			}
			if (isset($data->method) && in_array($data->method,['PUT','PATCH','DELETE'])) {
				$this->set([
					CURLOPT_CUSTOMREQUEST => $data->method,
					CURLOPT_POSTFIELDS => $data->body()
				]);
			}
		}
		return (boolean) curl_setopt_array($this->_resource, $this->options);
	}
public function write ( $ data = null ) { if ( ! is_resource ( $ this -> _resource ) ) { return false ; } if ( ! is_object ( $ data ) ) { $ data = $ this -> _instance ( $ this -> _classes [ 'request' ] , ( array ) $ data + $ this -> _config ) ; } $ this -> set ( CURLOPT_URL , $ data -> to ( 'url' ) ) ; if ( $ data instanceof Message ) { if ( ! empty ( $ this -> _config [ 'ignoreExpect' ] ) ) { $ data -> headers ( 'Expect' , ' ' ) ; } if ( isset ( $ data -> headers ) ) { $ this -> set ( CURLOPT_HTTPHEADER , $ data -> headers ( ) ) ; } if ( isset ( $ data -> method ) && $ data -> method === 'POST' ) { $ this -> set ( [ CURLOPT_POST => true , CURLOPT_POSTFIELDS => $ data -> body ( ) ] ) ; } if ( isset ( $ data -> method ) && in_array ( $ data -> method , [ 'PUT' , 'PATCH' , 'DELETE' ] ) ) { $ this -> set ( [ CURLOPT_CUSTOMREQUEST => $ data -> method , CURLOPT_POSTFIELDS => $ data -> body ( ) ] ) ; } } return ( boolean ) curl_setopt_array ( $ this -> _resource , $ this -> options ) ; }
Writes data to curl options

@param array|\lithium\net\Message $data
@return boolean
Writes data to curl options