original_string: private function normalizeBody($body = null)
      {
          $body = $body ? $body : new Stream(fopen('php://temp', 'r+'));
          if (is_string($body)) {
              $memoryStream = fopen('php://temp', 'r+');
              fwrite($memoryStream, $body);
              rewind($memoryStream);
              $body = new Stream($memoryStream);
          } elseif (!($body instanceof StreamInterface)) {
              throw new InvalidArgumentException(
                  'Body must be a string, null or implement Psr\Http\Message\StreamInterface'
              );
          }
  
          return $body;
      }
code: private function normalizeBody($body = null)
      {
          $body = $body ? $body : new Stream(fopen('php://temp', 'r+'));
          if (is_string($body)) {
              $memoryStream = fopen('php://temp', 'r+');
              fwrite($memoryStream, $body);
              rewind($memoryStream);
              $body = new Stream($memoryStream);
          } elseif (!($body instanceof StreamInterface)) {
              throw new InvalidArgumentException(
                  'Body must be a string, null or implement Psr\Http\Message\StreamInterface'
              );
          }
  
          return $body;
      }
code_tokens: private function normalizeBody ( $ body = null ) { $ body = $ body ? $ body : new Stream ( fopen ( 'php://temp' , 'r+' ) ) ; if ( is_string ( $ body ) ) { $ memoryStream = fopen ( 'php://temp' , 'r+' ) ; fwrite ( $ memoryStream , $ body ) ; rewind ( $ memoryStream ) ; $ body = new Stream ( $ memoryStream ) ; } elseif ( ! ( $ body instanceof StreamInterface ) ) { throw new InvalidArgumentException ( 'Body must be a string, null or implement Psr\Http\Message\StreamInterface' ) ; } return $ body ; }
docstring: Normalize provided body and ensure that the result object is Stream.
  
  @param StreamInterface|string|null $body The request body object
  
  @return Stream Normalized body
  
  @throws \InvalidArgumentException If an unsupported argument type is provided.
docstring_tokens: Normalize provided body and ensure that the result object is Stream .