Fireguard\Report\Exporters\ImageExporter::setFormat PHP Méthode

setFormat() public méthode

public setFormat ( string $format ) : AbstractPhantomExporter
$format string
Résultat AbstractPhantomExporter
    public function setFormat($format)
    {
        parent::setFormat($format);
        $this->extension = '.' . strtolower($this->getFormat());
        return $this;
    }

Usage Example

 public function testCreateResponseForceDownload()
 {
     $exporter = new ImageExporter(null, 'test-file-name-download');
     $report = new Report('<section class="content">Content</section>');
     $response = $exporter->setFormat('JPG')->response($report, true);
     $this->assertInstanceOf(Response::class, $response);
     $this->assertTrue($response->headers->contains('content-disposition', 'attachment; filename="test-file-name-download.jpg"'), 'Could not find header to force download');
 }