azure-storage-table/src/Table/Models/BatchResult.php
private static function _constructResponses($body, IMimeReaderWriter $mimeSerializer)
    {
        $responses = array();
        $parts     = $mimeSerializer->decodeMimeMultipart($body);
        // Decrease the count of parts to remove the batch response body and just
        // include change sets response body. We may need to undo this action in
        // case that batch response body has useful info.
        $count = count($parts);

        for ($i = 0; $i < $count; $i++) {
            $response = new \stdClass();

            // Split lines
            $lines    = preg_split("/\\r\\n|\\r|\\n/", $parts[$i]);
            // Version Status Reason
            $statusTokens = explode(' ', $lines[0], 3);
            $response->version = $statusTokens[0];
            $response->statusCode = $statusTokens[1];
            $response->reason = $statusTokens[2];

            $headers = array();
            $j       = 1;
            do {
                $headerLine = $lines[$j++];
                $headerTokens = explode(':', $headerLine);
                $headers[trim($headerTokens[0])] =
                    isset($headerTokens[1]) ? trim($headerTokens[1]) : null;
            } while (Resources::EMPTY_STRING != $headerLine);
            $response->headers = $headers;
            $response->body = implode(PHP_EOL, array_slice($lines, $j));
            $responses[] = $response;
        }

        return $responses;
    }
private static function _constructResponses($body, IMimeReaderWriter $mimeSerializer)
    {
        $responses = array();
        $parts     = $mimeSerializer->decodeMimeMultipart($body);
        // Decrease the count of parts to remove the batch response body and just
        // include change sets response body. We may need to undo this action in
        // case that batch response body has useful info.
        $count = count($parts);

        for ($i = 0; $i < $count; $i++) {
            $response = new \stdClass();

            // Split lines
            $lines    = preg_split("/\\r\\n|\\r|\\n/", $parts[$i]);
            // Version Status Reason
            $statusTokens = explode(' ', $lines[0], 3);
            $response->version = $statusTokens[0];
            $response->statusCode = $statusTokens[1];
            $response->reason = $statusTokens[2];

            $headers = array();
            $j       = 1;
            do {
                $headerLine = $lines[$j++];
                $headerTokens = explode(':', $headerLine);
                $headers[trim($headerTokens[0])] =
                    isset($headerTokens[1]) ? trim($headerTokens[1]) : null;
            } while (Resources::EMPTY_STRING != $headerLine);
            $response->headers = $headers;
            $response->body = implode(PHP_EOL, array_slice($lines, $j));
            $responses[] = $response;
        }

        return $responses;
    }
Creates a array of responses from the batch response body.

@param string            $body           The HTTP response body.
@param IMimeReaderWriter $mimeSerializer The MIME reader and writer.

@return array