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;
        }
    }
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;
        }
    }
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 ; } }
Sets the headers from the given array.

@param string[]|string[][] $headers
Sets the headers from the given array .