public function write(iterable $data, ?array $headers = null): void
    {
        $this->assertAttached();

        $this->begin($headers);

        foreach ($data as $element) {
            $this->writeElement($element);
        }

        $this->end();
    }
public function write(iterable $data, ?array $headers = null): void
    {
        $this->assertAttached();

        $this->begin($headers);

        foreach ($data as $element) {
            $this->writeElement($element);
        }

        $this->end();
    }
public function write ( iterable $ data , ? array $ headers = null ) : void { $ this -> assertAttached ( ) ; $ this -> begin ( $ headers ) ; foreach ( $ data as $ element ) { $ this -> writeElement ( $ element ) ; } $ this -> end ( ) ; }
Write to traversable data to stream.

@param iterable      $data
@param string[]|null $headers
@return void
Write to traversable data to stream .