protected function formatBody($body, string $format)
	{
		$mime = "application/{$format}";
		$this->setContentType($mime);
		$this->bodyFormat = $format;

		// Nothing much to do for a string...
		if (! is_string($body))
		{
			/**
			 * @var Format $config
			 */
			$config    = config(Format::class);
			$formatter = $config->getFormatter($mime);

			$body = $formatter->format($body);
		}

		return $body;
	}
protected function formatBody($body, string $format)
	{
		$mime = "application/{$format}";
		$this->setContentType($mime);
		$this->bodyFormat = $format;

		// Nothing much to do for a string...
		if (! is_string($body))
		{
			/**
			 * @var Format $config
			 */
			$config    = config(Format::class);
			$formatter = $config->getFormatter($mime);

			$body = $formatter->format($body);
		}

		return $body;
	}
protected function formatBody ( $ body , string $ format ) { $ mime = "application/{$format}" ; $ this -> setContentType ( $ mime ) ; $ this -> bodyFormat = $ format ; // Nothing much to do for a string... if ( ! is_string ( $ body ) ) { /**
			 * @var Format $config
			 */ $ config = config ( Format :: class ) ; $ formatter = $ config -> getFormatter ( $ mime ) ; $ body = $ formatter -> format ( $ body ) ; } return $ body ; }
Handles conversion of the of the data into the appropriate format,
and sets the correct Content-Type header for our response.

@param string|array $body
@param string       $format Valid: json, xml

@return mixed
@throws \InvalidArgumentException If the body property is not string or array.
Handles conversion of the of the data into the appropriate format and sets the correct Content - Type header for our response .