Fireguard\Report\Exporters\AbstractPhantomExporter::mountScriptForExport PHP Method

mountScriptForExport() public method

public mountScriptForExport ( ) : string
return string Path for generated script
    public function mountScriptForExport()
    {
        $script = ' 
            var fs = require("fs");
            var args = require("system").args;
            var page = require("webpage").create();
            
            page.viewportSize = { width: ' . $this->getViewPortWidth() . ', height: ' . $this->getViewPortHeight() . '};
            
            page.paperSize = {
                format: "' . $this->getFormat() . '",
                orientation: "' . $this->getOrientation() . '",
                margin: ' . $this->getMargin() . ',
                footer: {
                    ' . $this->getFooterScript() . '
                },
                header: {
                    ' . $this->getHeaderScript() . '
                },
            };
            
            page.open( args[1], function( status ) {

                if ( status === "success" ) {
                    page.render( args[2] );
                }

                phantom.exit();
            });
            
        ';
        $filePath = tempnam(sys_get_temp_dir(), 'report-script-');
        file_put_contents($filePath, $this->compress($script));
        return $filePath;
    }