original_string: protected function setHeaders(array $headers)
      {
          // Ensure this is an atomic operation, either all headers are set or none.
          $before = $this->headers;
  
          try {
              foreach ($headers as $name => $value) {
                  $this->setHeader($name, $value);
              }
          } catch (\Throwable $e) {
              $this->headers = $before;
  
              throw $e;
          }
      }
code: protected function setHeaders(array $headers)
      {
          // Ensure this is an atomic operation, either all headers are set or none.
          $before = $this->headers;
  
          try {
              foreach ($headers as $name => $value) {
                  $this->setHeader($name, $value);
              }
          } catch (\Throwable $e) {
              $this->headers = $before;
  
              throw $e;
          }
      }
code_tokens: protected function setHeaders ( array $ headers ) { // Ensure this is an atomic operation, either all headers are set or none. $ before = $ this -> headers ; try { foreach ( $ headers as $ name => $ value ) { $ this -> setHeader ( $ name , $ value ) ; } } catch ( \ Throwable $ e ) { $ this -> headers = $ before ; throw $ e ; } }
docstring: Sets the headers from the given array.
  
  @param string[]|string[][] $headers
docstring_tokens: Sets the headers from the given array .