Introduce PrinterInterface.

This commit is contained in:
Malte Hübner 2018-02-13 13:52:02 +01:00
parent dc4cc81bbc
commit fa8fbd06cf
2 changed files with 90 additions and 23 deletions

View File

@ -5,7 +5,7 @@ namespace StaticMapLite\Printer;
use StaticMapLite\Canvas\CanvasInterface; use StaticMapLite\Canvas\CanvasInterface;
use StaticMapLite\TileResolver\TileResolverInterface; use StaticMapLite\TileResolver\TileResolverInterface;
abstract class AbstractPrinter abstract class AbstractPrinter implements PrinterInterface
{ {
/** @var int $maxWidth */ /** @var int $maxWidth */
protected $maxWidth = 1024; protected $maxWidth = 1024;
@ -72,7 +72,7 @@ abstract class AbstractPrinter
return $this->maxWidth; return $this->maxWidth;
} }
public function setMaxWidth(int $maxWidth): AbstractPrinter public function setMaxWidth(int $maxWidth): PrinterInterface
{ {
$this->maxWidth = $maxWidth; $this->maxWidth = $maxWidth;
@ -84,7 +84,7 @@ abstract class AbstractPrinter
return $this->maxHeight; return $this->maxHeight;
} }
public function setMaxHeight(int $maxHeight): AbstractPrinter public function setMaxHeight(int $maxHeight): PrinterInterface
{ {
$this->maxHeight = $maxHeight; $this->maxHeight = $maxHeight;
@ -96,7 +96,7 @@ abstract class AbstractPrinter
return $this->tileResolver; return $this->tileResolver;
} }
public function setTileResolver(TileResolverInterface $tileResolver): AbstractPrinter public function setTileResolver(TileResolverInterface $tileResolver): PrinterInterface
{ {
$this->tileResolver = $tileResolver; $this->tileResolver = $tileResolver;
@ -108,7 +108,7 @@ abstract class AbstractPrinter
return $this->canvas; return $this->canvas;
} }
public function setCanvas(CanvasInterface $canvas): AbstractPrinter public function setCanvas(CanvasInterface $canvas): PrinterInterface
{ {
$this->canvas = $canvas; $this->canvas = $canvas;
@ -120,7 +120,7 @@ abstract class AbstractPrinter
return $this->tileSize; return $this->tileSize;
} }
public function setTileSize(int $tileSize): AbstractPrinter public function setTileSize(int $tileSize): PrinterInterface
{ {
$this->tileSize = $tileSize; $this->tileSize = $tileSize;
@ -132,7 +132,7 @@ abstract class AbstractPrinter
return $this->tileSrcUrl; return $this->tileSrcUrl;
} }
public function setTileSrcUrl(array $tileSrcUrl): AbstractPrinter public function setTileSrcUrl(array $tileSrcUrl): PrinterInterface
{ {
$this->tileSrcUrl = $tileSrcUrl; $this->tileSrcUrl = $tileSrcUrl;
@ -144,7 +144,7 @@ abstract class AbstractPrinter
return $this->tileDefaultSrc; return $this->tileDefaultSrc;
} }
public function setTileDefaultSrc(string $tileDefaultSrc): AbstractPrinter public function setTileDefaultSrc(string $tileDefaultSrc): PrinterInterface
{ {
$this->tileDefaultSrc = $tileDefaultSrc; $this->tileDefaultSrc = $tileDefaultSrc;
@ -156,7 +156,7 @@ abstract class AbstractPrinter
return $this->osmLogo; return $this->osmLogo;
} }
public function setOsmLogo(string $osmLogo): AbstractPrinter public function setOsmLogo(string $osmLogo): PrinterInterface
{ {
$this->osmLogo = $osmLogo; $this->osmLogo = $osmLogo;
@ -168,7 +168,7 @@ abstract class AbstractPrinter
return $this->useTileCache; return $this->useTileCache;
} }
public function setUseTileCache(bool $useTileCache): AbstractPrinter public function setUseTileCache(bool $useTileCache): PrinterInterface
{ {
$this->useTileCache = $useTileCache; $this->useTileCache = $useTileCache;
@ -180,7 +180,7 @@ abstract class AbstractPrinter
return $this->zoom; return $this->zoom;
} }
public function setZoom(int $zoom): AbstractPrinter public function setZoom(int $zoom): PrinterInterface
{ {
$this->zoom = $zoom; $this->zoom = $zoom;
@ -192,7 +192,7 @@ abstract class AbstractPrinter
return $this->lat; return $this->lat;
} }
public function setLat(float $lat): AbstractPrinter public function setLat(float $lat): PrinterInterface
{ {
$this->lat = $lat; $this->lat = $lat;
@ -204,7 +204,7 @@ abstract class AbstractPrinter
return $this->lon; return $this->lon;
} }
public function setLon(float $lon): AbstractPrinter public function setLon(float $lon): PrinterInterface
{ {
$this->lon = $lon; $this->lon = $lon;
@ -216,7 +216,7 @@ abstract class AbstractPrinter
return $this->width; return $this->width;
} }
public function setWidth($width): AbstractPrinter public function setWidth($width): PrinterInterface
{ {
$this->width = $width; $this->width = $width;
@ -228,7 +228,7 @@ abstract class AbstractPrinter
return $this->height; return $this->height;
} }
public function setHeight($height): AbstractPrinter public function setHeight($height): PrinterInterface
{ {
$this->height = $height; $this->height = $height;
@ -240,7 +240,7 @@ abstract class AbstractPrinter
return $this->image; return $this->image;
} }
public function setImage($image): AbstractPrinter public function setImage($image): PrinterInterface
{ {
$this->image = $image; $this->image = $image;
@ -252,7 +252,7 @@ abstract class AbstractPrinter
return $this->maptype; return $this->maptype;
} }
public function setMaptype(string $maptype): AbstractPrinter public function setMaptype(string $maptype): PrinterInterface
{ {
$this->maptype = $maptype; $this->maptype = $maptype;
@ -264,7 +264,7 @@ abstract class AbstractPrinter
return $this->centerX; return $this->centerX;
} }
public function setCenterX($centerX): AbstractPrinter public function setCenterX($centerX): PrinterInterface
{ {
$this->centerX = $centerX; $this->centerX = $centerX;
@ -276,7 +276,7 @@ abstract class AbstractPrinter
return $this->centerY; return $this->centerY;
} }
public function setCenterY(int $centerY): AbstractPrinter public function setCenterY(int $centerY): PrinterInterface
{ {
$this->centerY = $centerY; $this->centerY = $centerY;
@ -288,7 +288,7 @@ abstract class AbstractPrinter
return $this->offsetX; return $this->offsetX;
} }
public function setOffsetX(int $offsetX): AbstractPrinter public function setOffsetX(int $offsetX): PrinterInterface
{ {
$this->offsetX = $offsetX; $this->offsetX = $offsetX;
@ -300,7 +300,7 @@ abstract class AbstractPrinter
return $this->offsetY; return $this->offsetY;
} }
public function setOffsetY(int $offsetY): AbstractPrinter public function setOffsetY(int $offsetY): PrinterInterface
{ {
$this->offsetY = $offsetY; $this->offsetY = $offsetY;
@ -312,7 +312,7 @@ abstract class AbstractPrinter
return $this->markers; return $this->markers;
} }
public function setMarkers(array $markers): AbstractPrinter public function setMarkers(array $markers): PrinterInterface
{ {
$this->markers = $markers; $this->markers = $markers;
@ -324,7 +324,7 @@ abstract class AbstractPrinter
return $this->polylines; return $this->polylines;
} }
public function setPolylines(array $polylines): AbstractPrinter public function setPolylines(array $polylines): PrinterInterface
{ {
$this->polylines = $polylines; $this->polylines = $polylines;

View File

@ -2,7 +2,74 @@
namespace StaticMapLite\Printer; namespace StaticMapLite\Printer;
use StaticMapLite\Canvas\CanvasInterface;
use StaticMapLite\TileResolver\TileResolverInterface;
interface PrinterInterface interface PrinterInterface
{ {
public function getMaxWidth(): int;
public function setMaxWidth(int $maxWidth): PrinterInterface;
public function getMaxHeight(): int;
public function setMaxHeight(int $maxHeight): PrinterInterface;
public function getTileResolver(): TileResolverInterface;
public function setTileResolver(TileResolverInterface $tileResolver): PrinterInterface;
public function getCanvas(): CanvasInterface;
public function setCanvas(CanvasInterface $canvas): PrinterInterface;
public function getTileSize(): int;
public function setTileSize(int $tileSize): PrinterInterface;
public function getTileSrcUrl(): array;
public function setTileSrcUrl(array $tileSrcUrl): PrinterInterface;
public function getTileDefaultSrc(): string;
public function setTileDefaultSrc(string $tileDefaultSrc): PrinterInterface;
public function getOsmLogo(): string;
public function setOsmLogo(string $osmLogo): PrinterInterface;
public function isUseTileCache(): bool;
public function setUseTileCache(bool $useTileCache): PrinterInterface;
public function getZoom(): int;
public function setZoom(int $zoom): PrinterInterface;
public function getLat(): float;
public function setLat(float $lat): PrinterInterface;
public function getLon(): float;
public function setLon(float $lon): PrinterInterface;
public function getWidth(): int;
public function setWidth($width): PrinterInterface;
public function getHeight(): int;
public function setHeight($height): PrinterInterface;
public function getImage();
public function setImage($image): PrinterInterface;
public function getMaptype(): string;
public function setMaptype(string $maptype): PrinterInterface;
public function getCenterX(): int;
public function setCenterX($centerX): PrinterInterface;
public function getCenterY(): int;
public function setCenterY(int $centerY): PrinterInterface;
public function getOffsetX(): int;
public function setOffsetX(int $offsetX): PrinterInterface;
public function getOffsetY(): int;
public function setOffsetY(int $offsetY): PrinterInterface;
public function getMarkers(): array;
public function setMarkers(array $markers): PrinterInterface;
public function getPolylines(): array;
public function setPolylines(array $polylines): PrinterInterface;
} }