Completed
Push — master ( 217b57...dfec3c )
by Luis
02:27
created
widget/OpenLayers.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@
 block discarded – undo
16 16
 class OpenLayers extends Widget
17 17
 {
18 18
 	/**
19
-     * @var array the HTML attributes for the container div of this widget.
20
-     * @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
21
-     */
19
+	 * @var array the HTML attributes for the container div of this widget.
20
+	 * @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
21
+	 */
22 22
 	public $options = [];
23 23
 	/**
24 24
 	 * The properties to be passed to the OpenLayers Map() constructor. In order to ease passing complex javascript structures, some simplifications are supported.
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,10 +96,10 @@
 block discarded – undo
96 96
 				if (is_string($options))
97 97
 					$options = ['source' => new OL("source.$options")];
98 98
 					
99
-				$processedLayers []= new OL("layer.$type", $options);
99
+				$processedLayers [] = new OL("layer.$type", $options);
100 100
 			}
101 101
 			else // Therefore $type is simply an integer array key
102
-				$processedLayers []= $options;
102
+				$processedLayers [] = $options;
103 103
 		}
104 104
 		$this->mapOptions['layers'] = $processedLayers;
105 105
 	}
Please login to merge, or discard this patch.
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -38,10 +38,12 @@  discard block
 block discarded – undo
38 38
 	
39 39
 	public function init()
40 40
 	{
41
-		if (!isset($this->options['id']))
42
-			$this->options['id'] = $this->getId();
43
-		if (!isset($this->jsVarName))
44
-			$this->jsVarName = $this->options['id'];
41
+		if (!isset($this->options['id'])) {
42
+					$this->options['id'] = $this->getId();
43
+		}
44
+		if (!isset($this->jsVarName)) {
45
+					$this->jsVarName = $this->options['id'];
46
+		}
45 47
 		$this->mapOptions['target'] = $this->options['id'];
46 48
 		OpenLayersBundle::register($this->view);
47 49
 	}
@@ -75,11 +77,13 @@  discard block
 block discarded – undo
75 77
 	 */
76 78
 	protected function processOptions()
77 79
 	{
78
-		if (isset($this->mapOptions['view']) && is_array($this->mapOptions['view']))
79
-			$this->mapOptions['view'] = new OL('View', $this->mapOptions['view']);
80
+		if (isset($this->mapOptions['view']) && is_array($this->mapOptions['view'])) {
81
+					$this->mapOptions['view'] = new OL('View', $this->mapOptions['view']);
82
+		}
80 83
 		
81
-		if (isset($this->mapOptions['layers']))
82
-			$this->processSimplifiedLayers();
84
+		if (isset($this->mapOptions['layers'])) {
85
+					$this->processSimplifiedLayers();
86
+		}
83 87
 	}
84 88
 	
85 89
 	/**
@@ -93,13 +97,15 @@  discard block
 block discarded – undo
93 97
 		{
94 98
 			if (is_string($type))
95 99
 			{
96
-				if (is_string($options))
97
-					$options = ['source' => new OL("source.$options")];
100
+				if (is_string($options)) {
101
+									$options = ['source' => new OL("source.$options")];
102
+				}
98 103
 					
99 104
 				$processedLayers []= new OL("layer.$type", $options);
100
-			}
101
-			else // Therefore $type is simply an integer array key
105
+			} else {
106
+				// Therefore $type is simply an integer array key
102 107
 				$processedLayers []= $options;
108
+			}
103 109
 		}
104 110
 		$this->mapOptions['layers'] = $processedLayers;
105 111
 	}
Please login to merge, or discard this patch.