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;
	}