/**
  * @param Message $message
  * @return string
  */
 private function getFormattedBody(Message $message)
 {
     $body = $message->getBody();
     if (!$body) {
         return '';
     }
     foreach ($this->formatters as $formatter) {
         if ($formatter->canFormat($message)) {
             return $formatter->format($body);
         }
     }
     return is_array($body) ? json_encode($body, JSON_PRETTY_PRINT) : $body;
 }
 /**
  * @param Message $message
  * @return bool
  */
 public function canFormat(Message $message)
 {
     $body = $message->getBody();
     $contentType = $message->getHeader('content-type');
     return !is_array($body) && strpos($contentType, 'xml') !== FALSE;
 }
 /**
  * @param Message $message
  * @return bool
  */
 public function canFormat(Message $message)
 {
     $body = $message->getBody();
     return is_array($body);
 }
 /**
  * @param Message $message
  * @return bool
  */
 public function canFormat(Message $message)
 {
     $body = $message->getBody();
     $contentType = $message->getHeader('content-type');
     return !is_array($body) && strpos($contentType, 'application/x-www-form-urlencoded') !== FALSE;
 }