Use OptionsBuilder in all mapper classes.

This commit is contained in:
David Molineus
2015-01-22 09:02:14 +01:00
parent b96cd80669
commit 52440c35dd
15 changed files with 14 additions and 99 deletions

View File

@@ -56,90 +56,6 @@ abstract class AbstractMapper implements Mapper
$this->initialize(); $this->initialize();
} }
/**
* Add a option mapping.
*
* @param string $option Name of the option.
* @param string $mapping Mapping column name. Set if column name differs.
*
* @return $this
*/
public function addOption($option, $mapping = null)
{
trigger_error(
__METHOD__ . ' is deprecated. Use $this->optionsBuilder->' . __FUNCTION__ . '()',
E_USER_DEPRECATED
);
$this->optionsBuilder->addOption($option, $mapping);
return $this;
}
/**
* Add options mapping.
*
* @param array|mixed $options List of option names.
*
* @return $this
*/
public function addOptions($options)
{
trigger_error(
__METHOD__ . ' is deprecated. Use $this->optionsBuilder->' . __FUNCTION__ . '()',
E_USER_DEPRECATED
);
$arguments = func_get_args();
$this->optionsBuilder->addOptions($arguments);
return $this;
}
/**
* Add a conditional option.
*
* @param string $column Condition column.
* @param string $option Option name.
* @param null $mapping Mapping column name.
* @param mixed $value Value of the conditional column.
*
* @return $this
*/
public function addConditionalOption($column, $option = null, $mapping = null, $value = self::VALUE_NOT_EMPTY)
{
trigger_error(
__METHOD__ . ' is deprecated. Use $this->optionsBuilder->' . __FUNCTION__ . '()',
E_USER_DEPRECATED
);
$this->optionsBuilder->addConditionalOption($column, $option, $mapping, $value);
return $this;
}
/**
* Add a conditional options.
*
* @param string $column Condition column.
* @param array $options Option names.
* @param mixed $value Value of the conditional column.
*
* @return $this
*/
public function addConditionalOptions($column, array $options, $value = self::VALUE_NOT_EMPTY)
{
trigger_error(
__METHOD__ . ' is deprecated. Use $this->optionsBuilder->' . __FUNCTION__ . '()',
E_USER_DEPRECATED
);
$this->optionsBuilder->addConditionalOptions($column, $options, $value);
return $this;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */

View File

@@ -32,6 +32,6 @@ class AbstractControlMapper extends AbstractTypeMapper
*/ */
protected function initialize() protected function initialize()
{ {
$this->addOption('position'); $this->optionsBuilder->addOption('position');
} }
} }

View File

@@ -44,7 +44,7 @@ class AttributionControlMapper extends AbstractControlMapper
{ {
parent::initialize(); parent::initialize();
$this->addConditionalOption('prefix'); $this->optionsBuilder->addConditionalOption('prefix');
} }
/** /**

View File

@@ -41,7 +41,7 @@ class FullscreenControlMapper extends AbstractControlMapper
{ {
parent::initialize(); parent::initialize();
$this $this->optionsBuilder
->addOption('forceSeparateButton', 'separate') ->addOption('forceSeparateButton', 'separate')
->addConditionalOption('title', 'title', 'buttonTitle') ->addConditionalOption('title', 'title', 'buttonTitle')
->addOption('forcePseudoFullScreen', 'simulateFullScreen'); ->addOption('forcePseudoFullScreen', 'simulateFullScreen');

View File

@@ -59,7 +59,7 @@ class LoadingControlMapper extends AbstractControlMapper
{ {
parent::initialize(); parent::initialize();
$this->addOption('separate'); $this->optionsBuilder->addOption('separate');
} }
/** /**

View File

@@ -39,6 +39,6 @@ class ScaleControlMapper extends AbstractControlMapper
{ {
parent::initialize(); parent::initialize();
$this->addOptions('maxWidth', 'metric', 'imperial', 'updateWhenIdle'); $this->optionsBuilder->addOptions('maxWidth', 'metric', 'imperial', 'updateWhenIdle');
} }
} }

View File

@@ -39,7 +39,7 @@ class ZoomControlMapper extends AbstractControlMapper
{ {
parent::initialize(); parent::initialize();
$this $this->optionsBuilder
->addConditionalOption('zoomInText') ->addConditionalOption('zoomInText')
->addConditionalOption('zoomOutText') ->addConditionalOption('zoomOutText')
->addConditionalOption('zoomInTitle') ->addConditionalOption('zoomInTitle')

View File

@@ -34,6 +34,6 @@ class AbstractLayerMapper extends AbstractTypeMapper
{ {
parent::initialize(); parent::initialize();
$this->addOption('label', 'title'); $this->optionsBuilder->addOption('label', 'title');
} }
} }

View File

@@ -16,7 +16,6 @@ use Netzmacht\Contao\Leaflet\Model\LayerModel;
use Netzmacht\JavascriptBuilder\Type\AnonymousFunction; use Netzmacht\JavascriptBuilder\Type\AnonymousFunction;
use Netzmacht\JavascriptBuilder\Type\Expression; use Netzmacht\JavascriptBuilder\Type\Expression;
use Netzmacht\LeafletPHP\Definition; use Netzmacht\LeafletPHP\Definition;
use Netzmacht\LeafletPHP\Definition\HasEvents;
use Netzmacht\LeafletPHP\Definition\Layer; use Netzmacht\LeafletPHP\Definition\Layer;
use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds; use Netzmacht\LeafletPHP\Definition\Type\LatLngBounds;
use Netzmacht\LeafletPHP\Plugins\MarkerCluster\MarkerClusterGroup; use Netzmacht\LeafletPHP\Plugins\MarkerCluster\MarkerClusterGroup;
@@ -50,7 +49,7 @@ class MarkerClusterLayerMapper extends AbstractLayerMapper
{ {
parent::initialize(); parent::initialize();
$this $this->optionsBuilder
->addOptions('showCoverageOnHover', 'zoomToBoundsOnClick', 'spiderfyOnMaxZoom') ->addOptions('showCoverageOnHover', 'zoomToBoundsOnClick', 'spiderfyOnMaxZoom')
->addOption('removeOutsideVisibleBounds') ->addOption('removeOutsideVisibleBounds')
->addConditionalOption('maxClusterRadius') ->addConditionalOption('maxClusterRadius')

View File

@@ -45,7 +45,7 @@ class MapMapper extends AbstractMapper
*/ */
protected function initialize() protected function initialize()
{ {
$this $this->optionsBuilder
->addOptions('center', 'zoom', 'zoomControl') ->addOptions('center', 'zoom', 'zoomControl')
->addOptions('dragging', 'touchZoom', 'scrollWheelZoom', 'doubleClickZoom', 'boxZoom', 'tap', 'keyboard') ->addOptions('dragging', 'touchZoom', 'scrollWheelZoom', 'doubleClickZoom', 'boxZoom', 'tap', 'keyboard')
->addOptions('trackResize', 'closeOnClick', 'bounceAtZoomLimits') ->addOptions('trackResize', 'closeOnClick', 'bounceAtZoomLimits')

View File

@@ -41,7 +41,7 @@ class FixedStyleMapper extends AbstractStyleMapper
{ {
parent::initialize(); parent::initialize();
$this $this->optionsBuilder
->addOptions('stroke', 'weight', 'opacity', 'clickable', 'className') ->addOptions('stroke', 'weight', 'opacity', 'clickable', 'className')
->addConditionalOption('color') ->addConditionalOption('color')
->addConditionalOption('lineCap') ->addConditionalOption('lineCap')

View File

@@ -32,6 +32,6 @@ class AbstractIconMapper extends AbstractTypeMapper
*/ */
protected function initialize() protected function initialize()
{ {
$this->addConditionalOption('className'); $this->optionsBuilder->addConditionalOption('className');
} }
} }

View File

@@ -44,7 +44,7 @@ class DivIconMapper extends AbstractIconMapper
{ {
parent::initialize(); parent::initialize();
$this->addOption('html'); $this->optionsBuilder->addOption('html');
} }
/** /**

View File

@@ -60,7 +60,7 @@ class MarkerMapper extends AbstractMapper
*/ */
protected function initialize() protected function initialize()
{ {
$this $this->optionsBuilder
->addConditionalOption('tooltip', 'title', 'tooltip') ->addConditionalOption('tooltip', 'title', 'tooltip')
->addConditionalOption('alt') ->addConditionalOption('alt')
->addConditionalOption('zIndexOffset') ->addConditionalOption('zIndexOffset')

View File

@@ -45,7 +45,7 @@ class CircleMapper extends AbstractVectorMapper
{ {
parent::initialize(); parent::initialize();
$this->addOption('radius'); $this->optionsBuilder->addOption('radius');
} }
/** /**