protected function populateResponseWithData($data, Response $response, ?Producer\ProducerInterface $producer): Response
	{
		if ($producer !== null)
		{
			$stream = $producer->assemble($data);
			if ($stream instanceof StreamInterface)
			{
				$response = $response->withBody($stream);
			}
			if ($producer instanceof Producer\HeaderInterface)
			{
				foreach ($producer->assembleHeaders($data) as $name => $value)
				{
					$response = $response->withHeader($name, $value);
				}
			}
		}
		return $response;
	}
protected function populateResponseWithData($data, Response $response, ?Producer\ProducerInterface $producer): Response
	{
		if ($producer !== null)
		{
			$stream = $producer->assemble($data);
			if ($stream instanceof StreamInterface)
			{
				$response = $response->withBody($stream);
			}
			if ($producer instanceof Producer\HeaderInterface)
			{
				foreach ($producer->assembleHeaders($data) as $name => $value)
				{
					$response = $response->withHeader($name, $value);
				}
			}
		}
		return $response;
	}
protected function populateResponseWithData ( $ data , Response $ response , ? Producer \ ProducerInterface $ producer ) : Response { if ( $ producer !== null ) { $ stream = $ producer -> assemble ( $ data ) ; if ( $ stream instanceof StreamInterface ) { $ response = $ response -> withBody ( $ stream ) ; } if ( $ producer instanceof Producer \ HeaderInterface ) { foreach ( $ producer -> assembleHeaders ( $ data ) as $ name => $ value ) { $ response = $ response -> withHeader ( $ name , $ value ) ; } } } return $ response ; }
Populates response with data using producer
@param mixed $data
@param Response $response
@param null|Producer\ProducerInterface $producer
@return Response
Populates response with data using producer