/** * @param string $html * @param array $arguments * @param string $uniqueId * * @return string */ public function rasterize($html, $arguments = array(), $uniqueId = "") { if ($uniqueId === "") { $uniqueId = uniqid("rasterize-"); } if ($this->stopwatch instanceof Stopwatch) { $this->stopwatch->start($uniqueId); } $input = $this->configHelper->getInputFilePath($uniqueId); $fh = fopen($input, 'w'); fwrite($fh, $html); fclose($fh); $output = $this->rasterizeUrl($this->configHelper->getOutputFileUrl($uniqueId), $arguments, $uniqueId); unlink($input); return $output; }
/** * @test */ public function isInputFilePathCorrect() { $this->assertEquals($this->normalizePath($this->rootDir . '/../web/bundles/padam87rasterize/temp' . DIRECTORY_SEPARATOR . 'e4e5k2.html'), $this->normalizePath($this->configHelper->getInputFilePath('e4e5k2'))); }