public function setEntity($entity, $prepare = true)
	{
		if($entity instanceof EntityInterface)
		{
			$this->entity = $entity;
		}
		elseif(is_resource($entity) || $entity instanceof StreamInterface)
		{
			$this->entity = new StreamEntity($entity);
		}
		elseif((is_array($entity) || is_object($entity)) && is_callable($entity))
		{
			$this->entity = new CallbackEntity($entity);
		}
		else
		{
			$this->entity = new StringEntity($entity);
		}
		
		if($prepare)
		{
			$this->entity->prepare($this);
		}
		
		return $this;
	}
public function setEntity($entity, $prepare = true)
	{
		if($entity instanceof EntityInterface)
		{
			$this->entity = $entity;
		}
		elseif(is_resource($entity) || $entity instanceof StreamInterface)
		{
			$this->entity = new StreamEntity($entity);
		}
		elseif((is_array($entity) || is_object($entity)) && is_callable($entity))
		{
			$this->entity = new CallbackEntity($entity);
		}
		else
		{
			$this->entity = new StringEntity($entity);
		}
		
		if($prepare)
		{
			$this->entity->prepare($this);
		}
		
		return $this;
	}
public function setEntity ( $ entity , $ prepare = true ) { if ( $ entity instanceof EntityInterface ) { $ this -> entity = $ entity ; } elseif ( is_resource ( $ entity ) || $ entity instanceof StreamInterface ) { $ this -> entity = new StreamEntity ( $ entity ) ; } elseif ( ( is_array ( $ entity ) || is_object ( $ entity ) ) && is_callable ( $ entity ) ) { $ this -> entity = new CallbackEntity ( $ entity ) ; } else { $ this -> entity = new StringEntity ( $ entity ) ; } if ( $ prepare ) { $ this -> entity -> prepare ( $ this ) ; } return $ this ; }
Convert the given argument into an HTTP entity and put it in the nessage.

@param mixed $entity
@param boolean $prepare Have the entity inject Content-Type etc. into the HTTP message?
@return HttpMessage
Convert the given argument into an HTTP entity and put it in the nessage .