2014-12-29 12:17:40 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @package dev
|
|
|
|
|
* @author David Molineus <david.molineus@netzmacht.de>
|
|
|
|
|
* @copyright 2014 netzmacht creative David Molineus
|
|
|
|
|
* @license LGPL 3.0
|
|
|
|
|
* @filesource
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace Netzmacht\Contao\Leaflet\Mapper;
|
|
|
|
|
|
2015-01-24 21:37:25 +01:00
|
|
|
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
2014-12-29 12:17:40 +01:00
|
|
|
use Netzmacht\LeafletPHP\Definition;
|
|
|
|
|
|
2015-01-12 19:03:29 +01:00
|
|
|
/**
|
|
|
|
|
* Interface Mapper describes the Mapper which translates a given configuration to the Leaflet definition.
|
|
|
|
|
*
|
|
|
|
|
* @package Netzmacht\Contao\Leaflet\Mapper
|
|
|
|
|
*/
|
2014-12-29 12:17:40 +01:00
|
|
|
interface Mapper
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Map model to the definition.
|
|
|
|
|
*
|
2015-01-12 19:03:29 +01:00
|
|
|
* @param \Model|mixed $model The model being built. Usually a contao model, but can be anything.
|
2015-01-09 13:41:09 +01:00
|
|
|
* @param DefinitionMapper $mapper The definition builder.
|
2015-01-24 21:37:25 +01:00
|
|
|
* @param Filter $filter Optional filter bounds.
|
2015-01-20 16:38:23 +01:00
|
|
|
* @param string $elementId Optional element.
|
|
|
|
|
* @param Definition|null $parent Optional passed parent.
|
2014-12-29 12:17:40 +01:00
|
|
|
*
|
|
|
|
|
* @return Definition
|
|
|
|
|
*/
|
2015-01-20 16:38:23 +01:00
|
|
|
public function handle(
|
|
|
|
|
$model,
|
|
|
|
|
DefinitionMapper $mapper,
|
2015-01-24 21:37:25 +01:00
|
|
|
Filter $filter = null,
|
2015-01-20 16:38:23 +01:00
|
|
|
$elementId = null,
|
|
|
|
|
Definition $parent = null
|
|
|
|
|
);
|
2014-12-29 12:17:40 +01:00
|
|
|
|
|
|
|
|
/**
|
2015-01-06 14:55:53 +01:00
|
|
|
* Check if mapper is responsible for the model.
|
2014-12-29 12:17:40 +01:00
|
|
|
*
|
2015-01-24 21:37:25 +01:00
|
|
|
* @param \Model $model The model being build.
|
|
|
|
|
* @param Filter $filter Optional filter bounds.
|
2014-12-29 12:17:40 +01:00
|
|
|
*
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
2015-01-24 21:37:25 +01:00
|
|
|
public function match($model, Filter $filter = null);
|
2014-12-29 12:17:40 +01:00
|
|
|
}
|