From 3abe5c65176aa1678b3296ca9060f97f204ef2ef Mon Sep 17 00:00:00 2001 From: David Molineus Date: Tue, 27 Jan 2015 17:58:03 +0100 Subject: [PATCH] Code style. --- src/Netzmacht/Contao/Leaflet/Dca/Marker.php | 7 +++++-- src/Netzmacht/Contao/Leaflet/Filter/BboxFilter.php | 2 +- src/Netzmacht/Contao/Leaflet/MapService.php | 2 +- .../Leaflet/Mapper/Layer/MarkersLayerMapper.php | 4 ++-- .../Contao/Leaflet/Mapper/OptionsBuilder.php | 12 ++++++++---- src/Netzmacht/Contao/Leaflet/Model/MarkerModel.php | 14 +++++++++----- 6 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/Netzmacht/Contao/Leaflet/Dca/Marker.php b/src/Netzmacht/Contao/Leaflet/Dca/Marker.php index 97bf4b4..d4f0ad8 100644 --- a/src/Netzmacht/Contao/Leaflet/Dca/Marker.php +++ b/src/Netzmacht/Contao/Leaflet/Dca/Marker.php @@ -84,9 +84,10 @@ class Marker $values = trimsplit(',', $value); $keys = array_keys($combined); + $count = count($values); - if (count($values) >= 2 && count($values) <= 3) { - for ($i = 0; $i < count($values); $i++) { + if ($count >= 2 && $count <= 3) { + for ($i = 0; $i < $count; $i++) { $combined[$keys[$i]] = $values[$i]; } } @@ -106,6 +107,8 @@ class Marker * @param \DataContainer $dataContainer The data container driver. * * @return string + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function loadCoordinates($value, $dataContainer) { diff --git a/src/Netzmacht/Contao/Leaflet/Filter/BboxFilter.php b/src/Netzmacht/Contao/Leaflet/Filter/BboxFilter.php index 4cc1a33..40e7436 100644 --- a/src/Netzmacht/Contao/Leaflet/Filter/BboxFilter.php +++ b/src/Netzmacht/Contao/Leaflet/Filter/BboxFilter.php @@ -30,7 +30,7 @@ class BboxFilter implements Filter /** * Construct. * - * @param \Netzmacht\LeafletPHP\Value\LatLngBounds $bounds The bounds. + * @param LatLngBounds $bounds The bounds. */ public function __construct(LatLngBounds $bounds) { diff --git a/src/Netzmacht/Contao/Leaflet/MapService.php b/src/Netzmacht/Contao/Leaflet/MapService.php index 7d72736..7acb87b 100644 --- a/src/Netzmacht/Contao/Leaflet/MapService.php +++ b/src/Netzmacht/Contao/Leaflet/MapService.php @@ -109,7 +109,7 @@ class MapService * Get map javascript. * * @param MapModel|int $mapId The map database id. MapModel accepted as well. - * @param \Netzmacht\LeafletPHP\Value\LatLngBounds $bounds Optional bounds where elements should be in. + * @param LatLngBounds $bounds Optional bounds where elements should be in. * @param string $elementId Optional element id. If none given the mapId or alias is used. * @param string $template The template being used for generating. * @param string $style Optional style attributes. diff --git a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkersLayerMapper.php b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkersLayerMapper.php index c827189..b7d8363 100644 --- a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkersLayerMapper.php +++ b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkersLayerMapper.php @@ -144,8 +144,8 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper /** * Load all layer markers. * - * @param \Model $model The layer model. - * @param Filter $filter null The request filter. + * @param \Model $model The layer model. + * @param Filter $filter The request filter. * * @return \Model\Collection|null */ diff --git a/src/Netzmacht/Contao/Leaflet/Mapper/OptionsBuilder.php b/src/Netzmacht/Contao/Leaflet/Mapper/OptionsBuilder.php index b935c0c..511f214 100644 --- a/src/Netzmacht/Contao/Leaflet/Mapper/OptionsBuilder.php +++ b/src/Netzmacht/Contao/Leaflet/Mapper/OptionsBuilder.php @@ -222,13 +222,17 @@ class OptionsBuilder } /** - * @param $option - * @param $value - * @param Definition $definition + * Apply an option. + * + * @param string $option The option name. + * @param mixed $value The option value. + * @param Definition $definition The definition. + * + * @return void */ private static function applyOption($option, $value, $definition) { - $setter = 'set' . ucfirst($option); + $setter = 'set' . ucfirst($option); if (method_exists($definition, $setter)) { $definition->$setter($value); diff --git a/src/Netzmacht/Contao/Leaflet/Model/MarkerModel.php b/src/Netzmacht/Contao/Leaflet/Model/MarkerModel.php index 8457dea..407867b 100644 --- a/src/Netzmacht/Contao/Leaflet/Model/MarkerModel.php +++ b/src/Netzmacht/Contao/Leaflet/Model/MarkerModel.php @@ -30,15 +30,17 @@ class MarkerModel extends AbstractActiveModel protected static $strTable = 'tl_leaflet_marker'; /** - * @param $pid - * @param Filter $filter + * Find by a filter. + * + * @param int $pid The parent id. + * @param Filter $filter The filter. * * @return \Model\Collection|null */ public static function findByFilter($pid, Filter $filter = null) { if (!$filter) { - return MarkerModel::findActiveBy('pid', $pid, array('order' => 'sorting')); + return static::findActiveBy('pid', $pid, array('order' => 'sorting')); } switch ($filter->getName()) { @@ -51,8 +53,10 @@ class MarkerModel extends AbstractActiveModel } /** - * @param $pid - * @param BboxFilter $filter + * Find by the bbox filter. + * + * @param int $pid The layer id. + * @param BboxFilter $filter The bbox filter. * * @return \Model\Collection|null */