Passed
Branchreleases (9f54f6)
by steve
31:18
created
neon/firefly/services/ImageManager.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
 
38 38
 		if (Arr::get($params, 'fit', false)) {
39 39
 			// add callback functionality to retain maximal original image size
40
-			$image->fit($width, $height, function ($constraint) {
40
+			$image->fit($width, $height, function($constraint) {
41 41
 				$constraint->upsize();
42 42
 			});
43 43
 		} elseif ($width || $height) {
44
-			$image->resize($width, $height, function ($constraint) {
44
+			$image->resize($width, $height, function($constraint) {
45 45
 				$constraint->aspectRatio();
46 46
 				$constraint->upsize();
47 47
 			});
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function runFilter(Image $image, $filter)
105 105
 	{
106
-		$filters = explode(',',$filter);
106
+		$filters = explode(',', $filter);
107 107
 		if (in_array('greyscale', $filters, true)) {
108 108
 			$this->runGreyscaleFilter($image);
109 109
 		}
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 			$x = Arr::get($params, 'x', null);
156 156
 			$y = Arr::get($params, 'y', null);
157 157
 		}
158
-		if ($w == 0 && $h == 0 && $x == 0 && $y ==0) {
158
+		if ($w == 0 && $h == 0 && $x == 0 && $y == 0) {
159 159
 			return $image;
160 160
 		}
161 161
 		$image->crop($w, $h, $x, $y);
Please login to merge, or discard this patch.
neon/core/grid/column/Button.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	 * @param array $options - additional html attribute options
32 32
 	 * @return $this
33 33
 	 */
34
-	public function setEdit($url, array $options=[])
34
+	public function setEdit($url, array $options = [])
35 35
 	{
36 36
 		$this->_buttons['edit'] = $options;
37 37
 		$this->_buttons['edit']['url'] = $url;
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @param array|string $url
44 44
 	 * @param array $options - additional html attribute options
45 45
 	 */
46
-	public function setDelete($url, array $options=[])
46
+	public function setDelete($url, array $options = [])
47 47
 	{
48 48
 		$this->_buttons['delete'] = $options;
49 49
 		$this->_buttons['delete']['url'] = $url;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 *   will append text to the CSS class e.g. btn-$type
60 60
 	 * @param array $options - passed to Html::buttonCustom
61 61
 	 */
62
-	public function addButton($key, $url, $text, $icon='', $class='', $options=[])
62
+	public function addButton($key, $url, $text, $icon = '', $class = '', $options = [])
63 63
 	{
64 64
 		$this->_buttons[$key] = array_merge(compact('url', 'text', 'icon', 'class'), $options);
65 65
 	}
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public function getWidth()
85 85
 	{
86
-		return 'calc(' . (count($this->_buttons)+count($this->_actions)) . ' * ' .$this->buttonWidth . ')';
86
+		return 'calc('.(count($this->_buttons) + count($this->_actions)).' * '.$this->buttonWidth.')';
87 87
 	}
88 88
 
89 89
 	/**
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 				if (!isset($btnOps['data']))
98 98
 					$btnOps['data'] = [];
99 99
 				if ($this->getGrid()->hasIndexColumn())
100
-					$btnOps['data'] = ['index' => $model[$this->getGrid()->getIndexColumn()->getKey()] ];
100
+					$btnOps['data'] = ['index' => $model[$this->getGrid()->getIndexColumn()->getKey()]];
101 101
 				$func = 'buttonCustom';
102 102
 				if ($buttonKey === 'delete') {
103 103
 					$func = 'buttonDelete';
104
-					$btnOps['data'] = Arr::merge($btnOps['data'], ['data'=> ['delete-ajax' => true ]]);
104
+					$btnOps['data'] = Arr::merge($btnOps['data'], ['data'=> ['delete-ajax' => true]]);
105 105
 				}
106 106
 				if ($buttonKey === 'edit') {
107 107
 					$func = 'buttonEdit';
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 				$text = Arr::remove($btnOps, 'text', '');
110 110
 				$url = Arr::remove($btnOps, 'url', '');
111 111
 				$url = $this->grid->replaceRowTagsWithValues($url, $model);
112
-				$btnOps['class'] = Arr::get($btnOps, 'class', '') . ' btn-grid';
112
+				$btnOps['class'] = Arr::get($btnOps, 'class', '').' btn-grid';
113 113
 				$buttons[] = Html::$func($url, $text, $btnOps);
114 114
 			}
115
-			return '<div class="btn-group btn-column">' . implode('', $buttons) . '</div>';
115
+			return '<div class="btn-group btn-column">'.implode('', $buttons).'</div>';
116 116
 		}
117 117
 	}
118 118
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -94,10 +94,12 @@
 block discarded – undo
94 94
 		if (count($this->_buttons)) {
95 95
 			$buttons = [];
96 96
 			foreach ($this->_buttons as $buttonKey => $btnOps) {
97
-				if (!isset($btnOps['data']))
98
-					$btnOps['data'] = [];
99
-				if ($this->getGrid()->hasIndexColumn())
100
-					$btnOps['data'] = ['index' => $model[$this->getGrid()->getIndexColumn()->getKey()] ];
97
+				if (!isset($btnOps['data'])) {
98
+									$btnOps['data'] = [];
99
+				}
100
+				if ($this->getGrid()->hasIndexColumn()) {
101
+									$btnOps['data'] = ['index' => $model[$this->getGrid()->getIndexColumn()->getKey()] ];
102
+				}
101 103
 				$func = 'buttonCustom';
102 104
 				if ($buttonKey === 'delete') {
103 105
 					$func = 'buttonDelete';
Please login to merge, or discard this patch.
neon/cms/components/Daedalus.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	 * @param array $params  any paramters from @see dds and dds_choice
174 174
 	 * @param object $renderer  the render object
175 175
 	 */
176
-	public function __construct($params, $renderer=null)
176
+	public function __construct($params, $renderer = null)
177 177
 	{
178 178
 		$this->params = $params;
179 179
 		$this->renderer = $renderer;
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 			$request = self::convertDataRequestToJson($this->params['data']);
199 199
 			$responded = self::$page->requestWidgetData($request, $data, $id, false, $meta);
200 200
 			if ($responded) {
201
-				$result['hasData'] = count($data)>0;
201
+				$result['hasData'] = count($data) > 0;
202 202
 				$result['hasResponse'] = true;
203 203
 				$result['data'] = $data;
204 204
 				$result['meta'] = $meta;
@@ -223,21 +223,21 @@  discard block
 block discarded – undo
223 223
 	 * @return null|errors|array  returns errors if not valid, null if called
224 224
 	 *   from within a template and the data if from within a plugin
225 225
 	 */
226
-	protected function queryChoice($template=true)
226
+	protected function queryChoice($template = true)
227 227
 	{
228 228
 		// check usage
229 229
 		if (!isset($this->params['member']))
230
-			return "Usage: you must provide a 'member' parameter. You provided ".print_r($this->params,true);
230
+			return "Usage: you must provide a 'member' parameter. You provided ".print_r($this->params, true);
231 231
 		if ($this->renderer && !isset($this->params['assign']))
232
-			return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params,true);
233
-		if (strpos($this->params['member'],':') === false && !isset($this->params['class']))
232
+			return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params, true);
233
+		if (strpos($this->params['member'], ':') === false && !isset($this->params['class']))
234 234
 			return "Usage: if you do not scope the member as class::member then you must provide the class parameter";
235 235
 
236 236
 		// extract out class and member
237 237
 		$class = null;
238 238
 		$member = null;
239
-		if (strpos($this->params['member'],':') !== false)
240
-			list ($class, $member) = explode(':', str_replace('::',':',$this->params['member']));
239
+		if (strpos($this->params['member'], ':') !== false)
240
+			list ($class, $member) = explode(':', str_replace('::', ':', $this->params['member']));
241 241
 		else {
242 242
 			$class = $this->params['class'];
243 243
 			$member = $this->params['member'];
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
 	{
286 286
 		// check usage
287 287
 		if (!isset($this->params['class']))
288
-			return "Usage: you must provide a 'class' parameter. You provided ".print_r($this->params,true);
288
+			return "Usage: you must provide a 'class' parameter. You provided ".print_r($this->params, true);
289 289
 
290 290
 		if ($this->renderer && !isset($this->params['assign']))
291
-			return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params,true);
291
+			return "Usage: you must provide an 'assign' parameter. You provided ".print_r($this->params, true);
292 292
 
293 293
 		$fields = isset($this->params['fields']) ? $this->params['fields'] : [];
294 294
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 				if (is_array($dps['dds_filter']))
385 385
 					$filters[] = json_encode($dps['dds_filter']);
386 386
 				// else deprecated json approach
387
-				else if (strpos(trim($dps['dds_filter']), '[')!==0)
387
+				else if (strpos(trim($dps['dds_filter']), '[') !== 0)
388 388
 					$filters[] = "[$dps[dds_filter]]";
389 389
 				else
390 390
 					$filters[] = $dps['dds_filter'];
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 
393 393
 			// create the filters clause
394 394
 			if (count($filters))
395
-				$data[] = "'filters':".implode(',',$filters);
395
+				$data[] = "'filters':".implode(',', $filters);
396 396
 
397 397
 			// sort out the order
398 398
 			if (isset($dps['dds_order'])) {
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 				$classType = $d['_class_type'];
458 458
 				foreach ($d as $field=>$value) {
459 459
 					// ignore all bookkeeping fields
460
-					if (strpos($field, '_')===0)
460
+					if (strpos($field, '_') === 0)
461 461
 						continue;
462 462
 					$edit[$i][$field] = self::createFieldEditable($classType, $field, $d['_uuid'], $value);
463 463
 				}
Please login to merge, or discard this patch.
neon/core/helpers/Html.php 1 patch
Braces   +26 added lines, -18 removed lines patch added patch discarded remove patch
@@ -154,8 +154,9 @@  discard block
 block discarded – undo
154 154
 			self::processTags($allowableTags, $tagsProcessed);
155 155
 		}
156 156
 		if (is_array($value)) {
157
-			foreach ($value as $k => $v)
158
-				$value[$k] = static::sanitise($v, $allowableTags);
157
+			foreach ($value as $k => $v) {
158
+							$value[$k] = static::sanitise($v, $allowableTags);
159
+			}
159 160
 		} else {
160 161
 			if (!is_null($value)) {
161 162
 				if (isset($tagsProcessed[$allowableTags])) {
@@ -189,14 +190,16 @@  discard block
 block discarded – undo
189 190
 	{
190 191
 		profile_begin('Html::purify', 'html');
191 192
 		if (is_array($value)) {
192
-			foreach ($value as $k => $v)
193
-				$value[$k] = static::purify($v, $allowedTags);
193
+			foreach ($value as $k => $v) {
194
+							$value[$k] = static::purify($v, $allowedTags);
195
+			}
194 196
 		} else {
195 197
 			if (!is_null($value)) {
196
-				if ($allowedTags === false)
197
-					$value = trim(HtmlPurifier::process($value));
198
-				else
199
-					$value = trim(HtmlPurifier::process(strip_tags($value, $allowedTags)));
198
+				if ($allowedTags === false) {
199
+									$value = trim(HtmlPurifier::process($value));
200
+				} else {
201
+									$value = trim(HtmlPurifier::process(strip_tags($value, $allowedTags)));
202
+				}
200 203
 			}
201 204
 		}
202 205
 		profile_end('Html::purify', 'html');
@@ -214,8 +217,9 @@  discard block
 block discarded – undo
214 217
 	public static function encodeEntities($value, $entities = ENT_QUOTES)
215 218
 	{
216 219
 		if (is_array($value)) {
217
-			foreach ($value as $k => $v)
218
-				$value[$k] = static::encodeEntities($v, $entities);
220
+			foreach ($value as $k => $v) {
221
+							$value[$k] = static::encodeEntities($v, $entities);
222
+			}
219 223
 		} else {
220 224
 			$value = htmlentities($value, $entities);
221 225
 		}
@@ -251,18 +255,22 @@  discard block
 block discarded – undo
251 255
 	 */
252 256
 	public static function highlight($search, $html, $empty='')
253 257
 	{
254
-		if ($html === null)
255
-			return neon()->formatter->nullDisplay;
256
-		if ($html === '')
257
-			return $empty;
258
-		if (empty($search))
259
-			return $html;
258
+		if ($html === null) {
259
+					return neon()->formatter->nullDisplay;
260
+		}
261
+		if ($html === '') {
262
+					return $empty;
263
+		}
264
+		if (empty($search)) {
265
+					return $html;
266
+		}
260 267
 
261 268
 		profile_begin('Html::Highlight');
262 269
 		// escape search and html entities as otherwise the loadHTML or appendXML
263 270
 		// can blow up if there are < & > in the data
264
-		if (!is_array($search))
265
-			$search = [$search];
271
+		if (!is_array($search)) {
272
+					$search = [$search];
273
+		}
266 274
 		try {
267 275
 			foreach ($search as $s) {
268 276
 				// now search and rebuild the data
Please login to merge, or discard this patch.
neon/core/view/SmartySharedPlugins.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 			$params['content'] = $content;
149 149
 			if (class_exists($class)) {
150 150
 				$widget = new $class();
151
-				foreach($params as $key => $val) {
151
+				foreach ($params as $key => $val) {
152 152
 					if ($widget->hasProperty($key))
153 153
 						$widget->$key = $val;
154 154
 				}
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		$type = Arr::getRequired($params, 'type');
179 179
 		$options = Arr::get($params, 'options', []);
180 180
 		if (!is_array($options))
181
-			throw new \InvalidArgumentException('"options" property must be an array "' . gettype($options) . '" given');
181
+			throw new \InvalidArgumentException('"options" property must be an array "'.gettype($options).'" given');
182 182
 		$default = Arr::get($params, 'default', '');
183 183
 
184 184
 		$value = neon()->view->styleManager->add($name, $default, $type, $options);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		if (!isset($params['route'])) {
216 216
 			trigger_error("path: missing 'route' parameter");
217 217
 		}
218
-		array_unshift($params, $params['route']) ;
218
+		array_unshift($params, $params['route']);
219 219
 		unset($params['route']);
220 220
 		return Url::toRoute($params, true);
221 221
 	}
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	 */
234 234
 	public function csrf_element($params)
235 235
 	{
236
-		return '<input type="hidden" name="'.neon()->request->csrfParam.'" value="' . neon()->request->getCsrfToken() . '" />';
236
+		return '<input type="hidden" name="'.neon()->request->csrfParam.'" value="'.neon()->request->getCsrfToken().'" />';
237 237
 	}
238 238
 
239 239
 	/**
@@ -329,39 +329,39 @@  discard block
 block discarded – undo
329 329
 			$params['widths'] = self::IMG_SRCSET_DEFAULT_WIDTHS;
330 330
 		}
331 331
 
332
-		$id = Arr::pull($params,'firefly_id');
333
-		$widths = array_map('trim',explode(',',Arr::pull($params,'widths')));
332
+		$id = Arr::pull($params, 'firefly_id');
333
+		$widths = array_map('trim', explode(',', Arr::pull($params, 'widths')));
334 334
 		$srcsetParts = [];
335 335
 		$srcSizeParts = [];
336 336
 		$useResolutions = [];
337 337
 		$minBreak = false;
338 338
 		if (isset($params['min-break'])) {
339
-			$minBreak = Arr::pull($params,'min-break');
340
-			if (!Str::validateNumericWithUnits($minBreak,['px','vw'])) {
339
+			$minBreak = Arr::pull($params, 'min-break');
340
+			if (!Str::validateNumericWithUnits($minBreak, ['px', 'vw'])) {
341 341
 				throw new \InvalidArgumentException("The min-break value '".$minBreak."' should be numeric and end with 'px' or 'vw'");
342 342
 			}
343 343
 		}
344 344
 		if (isset($params['breaks'])) {
345 345
 			// optionally validate & collate the breaks for the 'sizes' attribute
346
-			$breaks = array_map('trim',explode(',',Arr::pull($params,'breaks')));
346
+			$breaks = array_map('trim', explode(',', Arr::pull($params, 'breaks')));
347 347
 			foreach ($breaks as $idx=>$break) {
348
-				if (!Str::validateNumericWithUnits($break, ['px','vw'])) {
348
+				if (!Str::validateNumericWithUnits($break, ['px', 'vw'])) {
349 349
 					throw new \InvalidArgumentException("The break value '".$break."' should be numeric and end with 'px' or 'vw'");
350 350
 				}
351
-				if ($idx==0 && $minBreak) {
351
+				if ($idx == 0 && $minBreak) {
352 352
 					$break = "(min-width: ".$minBreak.") ".$break;
353 353
 				}
354
-				$srcSizeParts[]=$break;
354
+				$srcSizeParts[] = $break;
355 355
 			}
356 356
 		}
357 357
 		elseif (isset($params['resolutions'])) {
358 358
 			// optionally validate & collate any specified resolutions to use (if breaks haven't been specified)
359
-			$useResolutions = array_map('trim',explode(',',Arr::pull($params,'resolutions')));
360
-			if (count($useResolutions) != count($widths)-1) {
361
-				throw new \InvalidArgumentException("Since there are ".count($widths)." widths you should specify ".(count($widths)-1)." resolutions to apply");
359
+			$useResolutions = array_map('trim', explode(',', Arr::pull($params, 'resolutions')));
360
+			if (count($useResolutions) != count($widths) - 1) {
361
+				throw new \InvalidArgumentException("Since there are ".count($widths)." widths you should specify ".(count($widths) - 1)." resolutions to apply");
362 362
 			}
363 363
 			foreach ($useResolutions as $useResolution) {
364
-				if (!Str::validateNumericWithUnits($useResolution,['x'])) {
364
+				if (!Str::validateNumericWithUnits($useResolution, ['x'])) {
365 365
 					throw new \InvalidArgumentException("The resolution '".$useResolution."' is not a valid resolution, it should be numeric and then end with an 'x'");
366 366
 				}
367 367
 			}
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 		else {
370 370
 			// if neither 'breaks' or 'resolutions' was specified then use the widths
371 371
 			foreach ($widths as $idx=>$width) {
372
-				if ($idx==0 && $minBreak) {
372
+				if ($idx == 0 && $minBreak) {
373 373
 					$width = "(min-width: ".$minBreak.") ".$width;
374 374
 				}
375 375
 				$srcSizeParts[] = $width."px";
@@ -388,31 +388,31 @@  discard block
 block discarded – undo
388 388
 			if (!is_numeric($width)) {
389 389
 				throw new \InvalidArgumentException("One of the widths specified was not numeric '".$width."'");
390 390
 			}
391
-			$useParams = ['id'=>$id, 'w'=>(int)$width];
391
+			$useParams = ['id'=>$id, 'w'=>(int) $width];
392 392
 			if ($useQuality) {
393 393
 				$useParams['q'] = $useQuality;
394 394
 			}
395 395
 			$imageUrl = $this->firefly_image($useParams);
396 396
 			if ($useResolutions) {
397
-				$srcsetParts[] = $imageUrl.( ($idx>=1) ? ' '.$useResolutions[$idx-1] : '' );
397
+				$srcsetParts[] = $imageUrl.(($idx >= 1) ? ' '.$useResolutions[$idx - 1] : '');
398 398
 			}
399 399
 			else {
400
-				$srcsetParts[] = $imageUrl . ' ' . $width . 'w';
400
+				$srcsetParts[] = $imageUrl.' '.$width.'w';
401 401
 			}
402
-			if ($idx==0 && !isset($params['src-width']) && !isset($params['src'])) {
402
+			if ($idx == 0 && !isset($params['src-width']) && !isset($params['src'])) {
403 403
 				$params['src'] = $imageUrl;
404 404
 			}
405 405
 		}
406 406
 
407 407
 		// collate the tag attributes
408 408
 		if (isset($params['src-width'])) {
409
-			$srcWidth = Arr::pull($params,'src-width');
409
+			$srcWidth = Arr::pull($params, 'src-width');
410 410
 			if (!is_numeric($srcWidth)) {
411 411
 				throw new \InvalidArgumentException("src-width '".$srcWidth."' must be numeric");
412 412
 			}
413
-			$useParams = ['id'=>$id, 'w'=>(int)$srcWidth];
413
+			$useParams = ['id'=>$id, 'w'=>(int) $srcWidth];
414 414
 			if (isset($params['quality'])) {
415
-				$useParams = (int)$params['quality'];
415
+				$useParams = (int) $params['quality'];
416 416
 			}
417 417
 			if (!isset($params['src'])) {
418 418
 				$params['src'] = $this->firefly_image($useParams);
@@ -426,12 +426,12 @@  discard block
 block discarded – undo
426 426
 		}
427 427
 
428 428
 		// finally generate the tag ... note that these can overwrite the previously generated params
429
-		$tagAttributes =  [];
429
+		$tagAttributes = [];
430 430
 		foreach ($params as $key=>$value) {
431 431
 			$tagAttributes[] = $key."='".htmlspecialchars($value)."'";
432 432
 		}
433 433
 
434
-		return "<img ".implode(' ',$tagAttributes).">";
434
+		return "<img ".implode(' ', $tagAttributes).">";
435 435
 	}
436 436
 
437 437
 	/**
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 			else
463 463
 				return $value;
464 464
 		} else {
465
-			return "Usage: you must provide an 'app' and a 'name' parameter. You provided ".print_r($params,true);
465
+			return "Usage: you must provide an 'app' and a 'name' parameter. You provided ".print_r($params, true);
466 466
 		}
467 467
 	}
468 468
 
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
 	{
485 485
 		$format = 'Y-m-d H:i:s';
486 486
 		if (isset($params['stamp']))
487
-			return date($format, (integer)$params['stamp']);
487
+			return date($format, (integer) $params['stamp']);
488 488
 		return date($format);
489 489
 	}
490 490
 
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 	 */
497 497
 	public function json($params)
498 498
 	{
499
-		return '<pre>' . json_encode($params, JSON_PRETTY_PRINT) . '</pre>';
499
+		return '<pre>'.json_encode($params, JSON_PRETTY_PRINT).'</pre>';
500 500
 	}
501 501
 
502 502
 	/**
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 	 * @return int
512 512
 	 * @throws \Exception
513 513
 	 */
514
-	public function getAssetPosition($params, $default='end')
514
+	public function getAssetPosition($params, $default = 'end')
515 515
 	{
516 516
 		$position = Arr::get($params, 'pos', Arr::get($params, 'position', $default));
517 517
 		$positions = [
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 			'load'  => View::POS_LOAD,
523 523
 		];
524 524
 		if (!array_key_exists($position, $positions)) {
525
-			throw new \Exception('The javascript position specified must be one of ' . print_r(array_keys($positions)) . ', you specified "'.$position.'"');
525
+			throw new \Exception('The javascript position specified must be one of '.print_r(array_keys($positions)).', you specified "'.$position.'"');
526 526
 		}
527 527
 		return $positions[$position];
528 528
 	}
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 	public function protectHtmlEntities($params, $smarty)
727 727
 	{
728 728
 		$input = $params['input'];
729
-		$output = str_replace('&','&amp;', $input);
729
+		$output = str_replace('&', '&amp;', $input);
730 730
 		if (!empty($params['assign'])) {
731 731
 			$smarty->assign($params['assign'], $output);
732 732
 		} else {
Please login to merge, or discard this patch.
neon/core/grid/column/IColumn.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
 
15 15
 interface IColumn
16 16
 {
17
-	public function __construct($config=[]);
17
+	public function __construct($config = []);
18 18
 
19
-	public function renderDataCell($model, $key, $index);  // GRID: called by grid
19
+	public function renderDataCell($model, $key, $index); // GRID: called by grid
20 20
 
21 21
 	/**
22 22
 	 * Renders the contents of the cell (can be overriden by setting self::setDataCellContentFunction)
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 * Set whether this column is sortable or not
150 150
 	 * @param bool $bool
151 151
 	 */
152
-	public function setIsSortable($bool=true);
152
+	public function setIsSortable($bool = true);
153 153
 
154 154
 	/**
155 155
 	 * Is the column sortable
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 *
251 251
 	 * @param boolean $bool
252 252
 	 */
253
-	public function setAsIndex($bool=true);
253
+	public function setAsIndex($bool = true);
254 254
 
255 255
 	/**
256 256
 	 * Set the title of the column
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	 *
300 300
 	 * @return null|callable
301 301
 	 */
302
-	public function getSearchFunction();  // GRID: called by grid
302
+	public function getSearchFunction(); // GRID: called by grid
303 303
 
304 304
 	/**
305 305
 	 * Set the database field name. This is used to lookup the row data, and in filters and ordering
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 	 * @param array $linkOptions
363 363
 	 * @return mixed
364 364
 	 */
365
-	public function addRowAction($key, $text, $linkOptions=[]);
365
+	public function addRowAction($key, $text, $linkOptions = []);
366 366
 
367 367
 	public function renderRowActions($model, $key, $index);
368 368
 
Please login to merge, or discard this patch.
neon/core/grid/column/Column.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 		return $this->_width;
174 174
 	}
175 175
 
176
-	public function __construct($config=[])
176
+	public function __construct($config = [])
177 177
 	{
178 178
 		parent::__construct($config);
179 179
 		if (!isset($config['key'])) {
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	/**
274 274
 	 * @inheritDoc
275 275
 	 */
276
-	public function setIsSortable($bool=true)
276
+	public function setIsSortable($bool = true)
277 277
 	{
278 278
 		$this->_sortable = $bool;
279 279
 	}
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 		return $this->_sortable;
287 287
 	}
288 288
 
289
-	public function setAsIndex($bool=true)
289
+	public function setAsIndex($bool = true)
290 290
 	{
291 291
 		$this->grid->setIndexedByColumn($this->key);
292 292
 		// thi is a bit gnarly but tests for yii Active record data providers specifically
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 			return $this->_dataCellContentFunction;
355 355
 		}
356 356
 		// check for convention
357
-		$functionName = 'render' . $this->key;
357
+		$functionName = 'render'.$this->key;
358 358
 		if (method_exists($this->grid, $functionName) && $functionName !== 'renderfile') {
359 359
 			return $functionName;
360 360
 		}
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 	/**
426 426
 	 * @inheritDoc
427 427
 	 */
428
-	public function setDbField($field){
428
+	public function setDbField($field) {
429 429
 		$this->_dbField = $field;
430 430
 		return $this;
431 431
 	}
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
 	/**
434 434
 	 * @inheritDoc
435 435
 	 */
436
-	public function getDbField(){
437
-		if ($this->_dbField === null){
436
+	public function getDbField() {
437
+		if ($this->_dbField === null) {
438 438
 			// set to be the key
439 439
 			$this->_dbField = $this->key;
440 440
 		}
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	/**
452 452
 	 * @inheritDoc
453 453
 	 */
454
-	public function setDbSortField($field){
454
+	public function setDbSortField($field) {
455 455
 		$this->_dbSortField = $field;
456 456
 		return $this;
457 457
 	}
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
 	/**
460 460
 	 * @inheritDoc
461 461
 	 */
462
-	public function getDbSortField(){
463
-		if ($this->_dbSortField === null){
462
+	public function getDbSortField() {
463
+		if ($this->_dbSortField === null) {
464 464
 			// set to be the key
465 465
 			$this->_dbSortField = $this->dbField;
466 466
 		}
@@ -509,9 +509,9 @@  discard block
 block discarded – undo
509 509
 		if ($this->grid->hasSort($this->key)) {
510 510
 			$sort = $this->grid->hasSortDescending() ? ' - ' : ' + ';
511 511
 		}
512
-		$sortParam = $this->grid->hasSortDescending() ? $this->key : '-' . $this->key;
512
+		$sortParam = $this->grid->hasSortDescending() ? $this->key : '-'.$this->key;
513 513
 		$url = neon()->getUrlManager()->createUrl([\Yii::$app->controller->getRoute(), $this->grid->id => ['sort' => $sortParam]]);
514
-		return Html::a($this->getTitle() . $sort, $url, ['data-sort'=>$sortParam]);
514
+		return Html::a($this->getTitle().$sort, $url, ['data-sort'=>$sortParam]);
515 515
 	}
516 516
 
517 517
 	/**
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 	public function getFilterField()
566 566
 	{
567 567
 		$field = $this->getBaseFilterField();
568
-		foreach($this->filterFieldConfig as $key => $value)
568
+		foreach ($this->filterFieldConfig as $key => $value)
569 569
 			$field[$key] = $value;
570 570
 		return $field;
571 571
 	}
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 
582 582
 	public function setMemberConfig($config)
583 583
 	{
584
-		foreach($config as $key => $value) {
584
+		foreach ($config as $key => $value) {
585 585
 			if (isset($this->member->$key))
586 586
 				$this->member->$key = $value;
587 587
 		}
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 	/**
592 592
 	 * @inheritDoc
593 593
 	 */
594
-	public function getCellData($row, $noValue='-')
594
+	public function getCellData($row, $noValue = '-')
595 595
 	{
596 596
 		$data = null;
597 597
 		$key = $this->getKey();
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 			if (is_array($display)) {
645 645
 				$display = implode(',', $display);
646 646
 			}
647
-			return "<span title=\"".str_replace('"',"'", html_entity_decode(strip_tags($display)))."\">$out</span>";
647
+			return "<span title=\"".str_replace('"', "'", html_entity_decode(strip_tags($display)))."\">$out</span>";
648 648
 		}
649 649
 		return $this->getCellData($model);
650 650
 	}
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 	 */
655 655
 	public function getFieldName()
656 656
 	{
657
-		return $this->getGrid()->getId() . '[' . $this->key . '][search]';
657
+		return $this->getGrid()->getId().'['.$this->key.'][search]';
658 658
 	}
659 659
 
660 660
 	/**
@@ -728,12 +728,12 @@  discard block
 block discarded – undo
728 728
 		throw new \Exception('Unable to call a valid search function');
729 729
 	}
730 730
 
731
-	protected $_actions =[];
731
+	protected $_actions = [];
732 732
 
733 733
 	/**
734 734
 	 * @inheritDoc
735 735
 	 */
736
-	public function addRowAction($key, $text, $linkOptions=[])
736
+	public function addRowAction($key, $text, $linkOptions = [])
737 737
 	{
738 738
 		$linkOptions['text'] = $text;
739 739
 		$linkOptions['data-action'] = $key;
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 		}
760 760
 		$out = '<div class="neonGrid_rowActions">';
761 761
 		$i = 0;
762
-		foreach($this->_actions as $actionKey => $linkOptions) {
762
+		foreach ($this->_actions as $actionKey => $linkOptions) {
763 763
 			if ($i > 0) $out .= ' | ';
764 764
 			if (isset($linkOptions['function'])) {
765 765
 				$func = $linkOptions['function'];
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
 	 * @param array $arguments of arguments
787 787
 	 * @return mixed
788 788
 	 */
789
-	public function callFunction($function, $arguments=[])
789
+	public function callFunction($function, $arguments = [])
790 790
 	{
791 791
 		if (is_string($function)) {
792 792
 			return call_user_func_array([$this->grid, $function], $arguments);
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 			if (count($columnData)) {
812 812
 				$this->member->dataMapFilters = ['uuid' => $columnData];
813 813
 			}
814
-			foreach($models as $model) {
814
+			foreach ($models as $model) {
815 815
 				$this->member->makeMapRequest($this->getCellData($model, null));
816 816
 			}
817 817
 		}
Please login to merge, or discard this patch.
neon/phoebe/services/adapters/appforms/PhoebeObject.php 1 patch
Braces   +33 added lines, -22 removed lines patch added patch discarded remove patch
@@ -41,8 +41,9 @@  discard block
 block discarded – undo
41 41
 	public function editObject($changes)
42 42
 	{
43 43
 		// check if there's anything to do
44
-		if (empty($changes) || $changes == $this->data)
45
-			return true;
44
+		if (empty($changes) || $changes == $this->data) {
45
+					return true;
46
+		}
46 47
 
47 48
 		// extract the data and save appropriately to
48 49
 		// the associated database tables ... if any
@@ -59,8 +60,9 @@  discard block
 block discarded – undo
59 60
 	public function setDataSources($sources)
60 61
 	{
61 62
 		foreach ($sources as $key=>$value) {
62
-			if (empty($value))
63
-				unset($sources[$key]);
63
+			if (empty($value)) {
64
+							unset($sources[$key]);
65
+			}
64 66
 		}
65 67
 		$this->dataSourceIds = $sources;
66 68
 	}
@@ -97,8 +99,9 @@  discard block
 block discarded – undo
97 99
 	 */
98 100
 	protected function getDataSources()
99 101
 	{
100
-		foreach ($this->dataSourceIds as $key=>$id)
101
-			$this->dataSourceObjects[$key] = $this->getDds()->getObject($id);
102
+		foreach ($this->dataSourceIds as $key=>$id) {
103
+					$this->dataSourceObjects[$key] = $this->getDds()->getObject($id);
104
+		}
102 105
 	}
103 106
 
104 107
 	/**
@@ -118,8 +121,9 @@  discard block
 block discarded – undo
118 121
 				$object = array_merge($this->getAllowedFieldsForClass($object['_classType']), $object);
119 122
 				// now update the object with the data from daedalus
120 123
 				$data = $dds->getObject($object['_uuid']);
121
-				if ($data)
122
-					$object = array_replace($object, array_intersect_key($data, $object));
124
+				if ($data) {
125
+									$object = array_replace($object, array_intersect_key($data, $object));
126
+				}
123 127
 			}
124 128
 			// recursively update if this is in a tree structure
125 129
 			if ($isTree && is_array($object)) {
@@ -179,8 +183,9 @@  discard block
 block discarded – undo
179 183
 				}
180 184
 			}
181 185
 		}
182
-		if (count($relations))
183
-			$this->saveLinkedObjects($relations);
186
+		if (count($relations)) {
187
+					$this->saveLinkedObjects($relations);
188
+		}
184 189
 	}
185 190
 
186 191
 	/**
@@ -216,8 +221,9 @@  discard block
 block discarded – undo
216 221
 							$relations = $renderables[$subRenderable]['relations'];
217 222
 							foreach ($relations as $relation) {
218 223
 								$memberRef = $relation['memberRef'];
219
-								if (!isset($extracted['__relations'][$objId][$memberRef]))
220
-									$extracted['__relations'][$objId][$memberRef] = [];
224
+								if (!isset($extracted['__relations'][$objId][$memberRef])) {
225
+																	$extracted['__relations'][$objId][$memberRef] = [];
226
+								}
221 227
 								$extracted['__relations'][$objId][$memberRef] = array_merge($extracted['__relations'][$objId][$memberRef], $newObjectIds);
222 228
 							}
223 229
 						}
@@ -259,8 +265,9 @@  discard block
 block discarded – undo
259 265
 		if (empty($fieldsForClass[$classType])) {
260 266
 			$definition = $this->getDefinition();
261 267
 			foreach ($definition['renderables'] as $r) {
262
-				if ($r['type'] == 'MemberComponent')
263
-					$fieldsForClass[$r['class_type']][$r['member_ref']] = null;
268
+				if ($r['type'] == 'MemberComponent') {
269
+									$fieldsForClass[$r['class_type']][$r['member_ref']] = null;
270
+				}
264 271
 			}
265 272
 		}
266 273
 		return $fieldsForClass[$classType];
@@ -322,8 +329,9 @@  discard block
 block discarded – undo
322 329
 			if (isset($renderables[$phoebeKey])) {
323 330
 				// check the renderable exists and is a class component
324 331
 				$ren = $renderables[$phoebeKey];
325
-				if ($ren['type'] != 'ClassComponent')
326
-					continue;
332
+				if ($ren['type'] != 'ClassComponent') {
333
+									continue;
334
+				}
327 335
 
328 336
 				// create the object and any required data params
329 337
 				$object = [
@@ -334,8 +342,9 @@  discard block
 block discarded – undo
334 342
 				foreach ($ren['items'] as $item) {
335 343
 					if (isset($renderables[$item])) {
336 344
 						$iRen = $renderables[$item];
337
-						if ($iRen['type'] != 'MemberComponent')
338
-							continue;
345
+						if ($iRen['type'] != 'MemberComponent') {
346
+													continue;
347
+						}
339 348
 						$object[$iRen['member_ref']] = null;
340 349
 					}
341 350
 				}
@@ -455,8 +464,9 @@  discard block
 block discarded – undo
455 464
 	private $_class = null;
456 465
 	private function getClass()
457 466
 	{
458
-		if (!$this->_class)
459
-			$this->_class = neon('phoebe')->getIPhoebeType($this->phoebeType)->getClass($this->classType);
467
+		if (!$this->_class) {
468
+					$this->_class = neon('phoebe')->getIPhoebeType($this->phoebeType)->getClass($this->classType);
469
+		}
460 470
 		return $this->_class;
461 471
 	}
462 472
 
@@ -469,8 +479,9 @@  discard block
 block discarded – undo
469 479
 	private $_dds = null;
470 480
 	private function getDds()
471 481
 	{
472
-		if (!$this->_dds)
473
-			$this->_dds = neon('dds')->getIDdsObjectManagement();
482
+		if (!$this->_dds) {
483
+					$this->_dds = neon('dds')->getIDdsObjectManagement();
484
+		}
474 485
 		return $this->_dds;
475 486
 	}
476 487
 
Please login to merge, or discard this patch.