diff --git a/src/Image.php b/src/Image.php index 517478a..2cb95a8 100644 --- a/src/Image.php +++ b/src/Image.php @@ -43,7 +43,7 @@ private function __construct($content, $format) */ public function __toString() { - return $this->content; + return (string) $this->content; } /** @@ -66,4 +66,5 @@ public function getFormat() { return $this->format; } + } diff --git a/src/Render/SvgFlatRender.php b/src/Render/SvgFlatRender.php index 588fee3..cd031c7 100644 --- a/src/Render/SvgFlatRender.php +++ b/src/Render/SvgFlatRender.php @@ -24,7 +24,7 @@ class SvgFlatRender implements RenderInterface { const VENDOR_COLOR = '#555'; private $textSizeCalculator; - +/* private static $template = << @@ -48,6 +48,58 @@ class SvgFlatRender implements RenderInterface EOF; + +quasi ok +รน private static $template = << + + + + + + + + + + + + + + + + + {{ vendor }} + {{ vendor }} + {{ value }} + {{ value }} + + +EOF; +*/ + +private static $template = << + + + + + + + + + + + + + + {{ vendor }} + {{ vendor }} + {{ value }} + {{ value }} + + +EOF; + /** * Constructor. * diff --git a/src/UI/Command.php b/src/UI/Command.php index 8077797..be66dd6 100644 --- a/src/UI/Command.php +++ b/src/UI/Command.php @@ -96,14 +96,18 @@ protected function execute(InputInterface $input, OutputInterface $output) protected function flushImage(InputInterface $input, OutputInterface $output, $imageContent) { - $output->write($imageContent); + $output->write((string) $imageContent); $this->header = ''; } protected function storeImage(InputInterface $input, OutputInterface $output, $path, $imageContent) { $this->printHeaderOnce($output); - $fp = fopen($path,"x"); // if file already exists warning is raised + try { + $fp = @fopen($path, "x"); + } catch (\Exception $e) { + $fp = false; + } if (false == $fp) { throw new \Exception("Error on creating the file maybe file [$path] already exists?"); @@ -112,7 +116,7 @@ protected function storeImage(InputInterface $input, OutputInterface $output, $p if ($written <1 || $written != strlen($imageContent)) { throw new \Exception('Error on writing to file.'); } - fclose($fp); + @fclose($fp); $output->write(sprintf('Image created at %s', $path)); }