Ejemplo n.º 1
0
 /**
  * @param RequestInterface $request
  * @return string
  * @throws FormatterException
  */
 public function format($request)
 {
     $body = $this->formatBody($request);
     $sections = ['Request Method' => $request->getMethod(), 'Request Url' => $request->getUrl(), 'Request Port' => $request->getPort(), 'Request Headers' => [], 'Request Body' => $body];
     $sections['Request Headers'] = $this->formatHeaders($request);
     $message = FormatterHelper::formatSections($sections);
     return $message;
 }
Ejemplo n.º 2
0
 /**
  * @param ResponseInterface $response
  * @return string
  * @throws FormatterException
  */
 public function format($response)
 {
     $body = $this->formatBody($response);
     $sections = ['Response Status Code' => $response->getStatusCode(), 'Response Protocol Version' => $response->getProtocolVersion(), 'Response Reason Phrase' => $response->getReasonPhrase(), 'Response Effective Url' => $response->getEffectiveUrl(), 'Response Headers' => [], 'Response Body' => $body];
     $sections['Response Headers'] = $this->formatHeaders($response);
     $message = FormatterHelper::formatSections($sections);
     return $message;
 }