Passed
Push — 2.3.2 ( ...2a5431 )
by steve
25:52 queued 12s
created
neon/cms/components/Widget.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		if (isset($params['type'])) {
118 118
 			$defaults['type'] = $params['type'];
119 119
 			// path to the file is determined by the theme hierarchy
120
-			$defaults['file'] = $params['type'] . '.tpl';
120
+			$defaults['file'] = $params['type'].'.tpl';
121 121
 			if (isset($params['key']))
122 122
 				self::buildDataFromCmsKeyAttributes($params);
123 123
  		}
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 			return $this->createStaticEditable($content);
238 238
 		} else {
239 239
 			$file = $this->params['file'];
240
-			$this->params['hasData'] = count($this->data)>0;
240
+			$this->params['hasData'] = count($this->data) > 0;
241 241
 			$this->params['hasResponse'] = true;
242 242
 			$this->params['data'] = $this->data;
243 243
 			$this->params['edit'] = $this->createDynamicEditable();
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 	public function getId()
304 304
 	{
305 305
 		if ($this->_id === null) {
306
-			$this->_id = $this->getPage()->getId() . '_' . static::$autoIdPrefix . static::$counter++;
306
+			$this->_id = $this->getPage()->getId().'_'.static::$autoIdPrefix.static::$counter++;
307 307
 		}
308 308
 		return $this->_id;
309 309
 	}
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 			$tag = Arr::get($this->params, 'tag', 'div');
348 348
 			$class = Arr::get($this->params, 'class', '');
349 349
 			if ((isset($this->params['wys']) || isset($this->params['wysiwyg'])) || (isset($this->params['editor']) && strpos('wys', $this->params['editor'] === 0)))
350
-				return '<'.$tag.' id="'.$this->getId().'" data-id="'.$this->getId().'" data-key="'.$dataKey.'" data-page-id="'.$dataPageId.'" class="cobe-editable cobe-static-block '.$class.'" contenteditable="true">' . $value . '</'.$tag.'>';
350
+				return '<'.$tag.' id="'.$this->getId().'" data-id="'.$this->getId().'" data-key="'.$dataKey.'" data-page-id="'.$dataPageId.'" class="cobe-editable cobe-static-block '.$class.'" contenteditable="true">'.$value.'</'.$tag.'>';
351 351
 			else
352 352
 				return "<$tag class='cobe-editable cobe-static ".$class."'  data-key='$dataKey' data-page-id='$dataPageId' contenteditable='true' />$value</$tag>";
353 353
 		} else {
Please login to merge, or discard this patch.
Braces   +29 added lines, -20 removed lines patch added patch discarded remove patch
@@ -118,11 +118,13 @@  discard block
 block discarded – undo
118 118
 			$defaults['type'] = $params['type'];
119 119
 			// path to the file is determined by the theme hierarchy
120 120
 			$defaults['file'] = $params['type'] . '.tpl';
121
-			if (isset($params['key']))
122
-				self::buildDataFromCmsKeyAttributes($params);
121
+			if (isset($params['key'])) {
122
+							self::buildDataFromCmsKeyAttributes($params);
123
+			}
123 124
  		}
124
-		if (isset($params['dds']) || isset($params['dds_page']) || isset($params['dds_class']))
125
-			Daedalus::buildDataFromDdsAttributes($params);
125
+		if (isset($params['dds']) || isset($params['dds_page']) || isset($params['dds_class'])) {
126
+					Daedalus::buildDataFromDdsAttributes($params);
127
+		}
126 128
 		$resolvedParams = Arr::merge($defaults, $params);
127 129
 		return $widget->render($resolvedParams, $template);
128 130
 	}
@@ -169,8 +171,9 @@  discard block
 block discarded – undo
169 171
 		}
170 172
 		// scb = static content block
171 173
 		$params['type'] = '_scb';
172
-		if (isset($params['key']))
173
-			self::buildDataFromCmsKeyAttributes($params);
174
+		if (isset($params['key'])) {
175
+					self::buildDataFromCmsKeyAttributes($params);
176
+		}
174 177
 		$params['content'] = $content;
175 178
 		$params['wys'] = (isset($params['wys']) ? $params['wys'] : true);
176 179
 		return $widget->render($params, $template);
@@ -206,8 +209,9 @@  discard block
 block discarded – undo
206 209
 		$data = [];
207 210
 		if (($dataRequest = $this->getDataRequest()) !== null) {
208 211
 			$id = $meta = null;
209
-			if (!$this->getPage()->requestWidgetData($dataRequest, $data, $id, $this->isStatic, $meta))
210
-				return $id;
212
+			if (!$this->getPage()->requestWidgetData($dataRequest, $data, $id, $this->isStatic, $meta)) {
213
+							return $id;
214
+			}
211 215
 			$this->saveData($data);
212 216
 			$this->saveDataMetaInformation($meta);
213 217
 		}
@@ -244,8 +248,9 @@  discard block
 block discarded – undo
244 248
 			$this->params['meta'] = $this->meta;
245 249
 
246 250
 			// createTemplate is an expensive call so only call it once per file and reset all variables on the stored template.
247
-			if (!isset($templates[$file]))
248
-				$templates[$file] = $this->renderer->createTemplate($file);
251
+			if (!isset($templates[$file])) {
252
+							$templates[$file] = $this->renderer->createTemplate($file);
253
+			}
249 254
 			$tpl = $templates[$file];
250 255
 			$tpl->tpl_vars = $tpl->config_vars = [];
251 256
 
@@ -263,8 +268,9 @@  discard block
 block discarded – undo
263 268
 	 */
264 269
 	protected function getDataRequest()
265 270
 	{
266
-		if (isset($this->params['data']))
267
-			return Daedalus::convertDataRequestToJson($this->params['data']);
271
+		if (isset($this->params['data'])) {
272
+					return Daedalus::convertDataRequestToJson($this->params['data']);
273
+		}
268 274
 		return null;
269 275
 	}
270 276
 
@@ -320,15 +326,17 @@  discard block
 block discarded – undo
320 326
 	 */
321 327
 	protected static function buildDataFromCmsKeyAttributes(&$params)
322 328
 	{
323
-		if (!isset($params['type'], $params['key']))
324
-			return;
329
+		if (!isset($params['type'], $params['key'])) {
330
+					return;
331
+		}
325 332
 		$key = "$params[type]_$params[key]";
326 333
 		$pageId = isset($params['page']) ? self::$page->getId() : null;
327 334
 		$params['data-key'] = $key;
328 335
 		$params['data-page-id'] = $pageId;
329 336
 		$params['data'] = "'key':'$key','pageId':'$pageId'";
330
-		if (!isset($params['content']))
331
-			$params['content'] = "Add Content for $params[key] here";
337
+		if (!isset($params['content'])) {
338
+					$params['content'] = "Add Content for $params[key] here";
339
+		}
332 340
 		$params['is_static'] = true;
333 341
 	}
334 342
 
@@ -346,10 +354,11 @@  discard block
 block discarded – undo
346 354
 			$dataPageId = $this->params['data-page-id'];
347 355
 			$tag = Arr::get($this->params, 'tag', 'div');
348 356
 			$class = Arr::get($this->params, 'class', '');
349
-			if ((isset($this->params['wys']) || isset($this->params['wysiwyg'])) || (isset($this->params['editor']) && strpos('wys', $this->params['editor'] === 0)))
350
-				return '<'.$tag.' id="'.$this->getId().'" data-id="'.$this->getId().'" data-key="'.$dataKey.'" data-page-id="'.$dataPageId.'" class="cobe-editable cobe-static-block '.$class.'" contenteditable="true">' . $value . '</'.$tag.'>';
351
-			else
352
-				return "<$tag class='cobe-editable cobe-static ".$class."'  data-key='$dataKey' data-page-id='$dataPageId' contenteditable='true' />$value</$tag>";
357
+			if ((isset($this->params['wys']) || isset($this->params['wysiwyg'])) || (isset($this->params['editor']) && strpos('wys', $this->params['editor'] === 0))) {
358
+							return '<'.$tag.' id="'.$this->getId().'" data-id="'.$this->getId().'" data-key="'.$dataKey.'" data-page-id="'.$dataPageId.'" class="cobe-editable cobe-static-block '.$class.'" contenteditable="true">' . $value . '</'.$tag.'>';
359
+			} else {
360
+							return "<$tag class='cobe-editable cobe-static ".$class."'  data-key='$dataKey' data-page-id='$dataPageId' contenteditable='true' />$value</$tag>";
361
+			}
353 362
 		} else {
354 363
 			return $value;
355 364
 		}
Please login to merge, or discard this patch.