Ikwattro\GuzzleStereo\Formatter\ResponseFormatter::encodeResponsesCollection PHP Method

encodeResponsesCollection() public method

public encodeResponsesCollection ( array $responses )
$responses array
    public function encodeResponsesCollection(array $responses)
    {
        $formatted = [];
        foreach ($responses as $response) {
            $formatted[] = $this->formatResponse($response);
        }
        return json_encode($formatted, JSON_PRETTY_PRINT);
    }

Usage Example

コード例 #1
0
ファイル: Recorder.php プロジェクト: sroze/guzzle-stereo
 /**
  * Returns the content of a specific tape without writing it to disk.
  *
  * @param string $name
  *
  * @return null|string
  */
 public function getTapeContent($name)
 {
     $tape = $this->getTape($name);
     if ($tape->hasResponses()) {
         $content = $this->formatter->encodeResponsesCollection($tape->getResponses());
         return $content;
     }
     return;
 }