Code style.

This commit is contained in:
David Molineus
2015-01-22 13:34:22 +01:00
parent 178da21895
commit 62e2b02732
9 changed files with 35 additions and 15 deletions

View File

@@ -21,8 +21,10 @@ class FrontendApi extends \Frontend
/**
* {@inheritdoc}
*/
// @codingStandardsIgnoreStart
public function replaceInsertTags($strBuffer, $blnCache = true)
{
return parent::replaceInsertTags($strBuffer, $blnCache);
}
// @codingStandardsIgnoreEnd
}

View File

@@ -43,7 +43,7 @@ class ValueFilter
* The idea behind this extra method is that we just have to change one place if anything else than the
* insert tags has to be replaced.
*
* @param string $value The given value
* @param string $value The given value.
*
* @return string
*/

View File

@@ -41,7 +41,7 @@ abstract class AbstractMapper implements Mapper
protected static $definitionClass = null;
/**
* Options builder
* Options builder.
*
* @var OptionsBuilder
*/

View File

@@ -60,7 +60,7 @@ class DefinitionMapper
/**
* Add a mapper.
*
* @param Mapper $mapper The mapper.
* @param Mapper $mapper The mapper.
* @param int $priority The priority. The higher priorities get called first.
*
* @return $this
@@ -165,6 +165,7 @@ class DefinitionMapper
* @param mixed $model The data model.
*
* @return Mapper
* @throws \RuntimeException If the mapper could not be found.
*/
private function getMapper($model)
{
@@ -178,7 +179,7 @@ class DefinitionMapper
throw new \RuntimeException(
sprintf(
'Could not build model "". No matching mappers found.',
'Could not build model "%s". No matching mappers found.',
$this->hash($model)
)
);

View File

@@ -63,7 +63,7 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
if ($model->pointToLayer || $model->affectBounds) {
$layer = new GeoJson($this->getElementId($model, $elementId));
if ($model->pointToLayer ) {
if ($model->pointToLayer) {
$layer->setPointToLayer(new Expression($model->pointToLayer));
}

View File

@@ -102,7 +102,10 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
) {
if ($definition instanceof GeoJson) {
$collection = $this->loadVectorModels($model);
$definition->setOption('affectBounds', (bool) $model->affectBounds);
if ($model->affectBounds) {
$definition->setOption('affectBounds', true);
}
if ($collection) {
foreach ($collection as $item) {
@@ -120,13 +123,7 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
}
}
if ($model->pointToLayer) {
$definition->setPointToLayer(new Expression($model->pointToLayer));
}
if ($model->onEachFeature) {
$definition->setOnEachFeature(new Expression($model->onEachFeature));
}
$this->addCallbacks($definition, $model);
}
}
@@ -170,4 +167,23 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
{
return VectorModel::findActiveBy('pid', $model->id, array('order' => 'sorting'));
}
/**
* Add javascript callbacks.
*
* @param GeoJson $definition The definition.
* @param \Model $model The database model.
*
* @return void
*/
protected function addCallbacks(GeoJson $definition, \Model $model)
{
if ($model->pointToLayer) {
$definition->setPointToLayer(new Expression($model->pointToLayer));
}
if ($model->onEachFeature) {
$definition->setOnEachFeature(new Expression($model->onEachFeature));
}
}
}

View File

@@ -14,7 +14,7 @@ namespace Netzmacht\Contao\Leaflet;
use Netzmacht\Contao\Leaflet\Frontend\ValueFilter;
/**
* Class ServiceContainer
* Class ServiceContainer provides the services which are available for Contao leaflet.
*
* @package Netzmacht\Contao\Leaflet
*/

View File

@@ -22,6 +22,7 @@ trait ServiceContainerTrait
* Get the service container.
*
* @return ServiceContainer
* @SuppressWarnings(PHPMD.Superglobals)
*/
protected function getServiceContainer()
{

View File

@@ -46,7 +46,7 @@ class HashSubscriber implements EventSubscriberInterface
$data = $event->getData();
if ($data instanceof \Model) {
$event->setHash($data->getTable() . '.' . $data->{$data->getPk()});
$event->setHash($data->getTable() . '::' . $data->{$data->getPk()});
}
}