Add type hint to canvas interface.

This commit is contained in:
Malte Hübner 2018-02-17 01:51:25 +01:00
parent 84c138d738
commit da772fca8c
2 changed files with 5 additions and 2 deletions

View File

@ -2,9 +2,11 @@
namespace StaticMapLite\Canvas;
use Imagine\Image\ImageInterface;
interface CanvasInterface
{
public function getImage();
public function getImage(): ImageInterface;
public function getWidth(): int;
public function getHeight(): int;
public function getCenterX(): float;

View File

@ -78,7 +78,8 @@ class MapCache
public function cache(CanvasInterface $canvas): void
{
$this->mkdir_recursive(dirname($this->mapCacheIDToFilename()), 0777);
imagepng($canvas->getImage(), $this->mapCacheIDToFilename(), 9);
$canvas->getImage()->save($this->mapCacheIDToFilename());
$output = new CacheOutput();
$output->setFilename($this->mapCacheIDToFilename())