Fireguard\Report\Exporters\HtmlExporter::generate PHP Метод

generate() публичный Метод

public generate ( Fireguard\Report\Contracts\ReportContract $report )
$report Fireguard\Report\Contracts\ReportContract
    public function generate(ReportContract $report)
    {
        $html = '<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>' . $this->fileName . '</title></head>';
        $html .= '<body style="background-color: #ffffff;">';
        $html .= $this->getProcessedHeader($report) . $report->getContent() . $this->getProcessedFooter($report);
        $html .= '</body></html>';
        return $this->saveFile($html);
    }

Usage Example

Пример #1
0
 public function testGenerateOnlyFooterReportFile()
 {
     $exporter = new HtmlExporter();
     $report = new Report('<section class="content">Content</section>', '', '<section class="footer">Footer</section>');
     $file = $exporter->generate($report);
     $this->assertFileExists($file);
     $expectHtml = '<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>' . $exporter->getFileName() . '</title></head><body style="background-color: #ffffff;"><section class="content">Content</section><section class=\'footer\'>Footer</section></body></html>';
     $this->assertStringEqualsFile($file, $expectHtml);
 }
All Usage Examples Of Fireguard\Report\Exporters\HtmlExporter::generate