Test Failed
Push — develop ( ff58ad...b8f9b2 )
by steve
13:44 queued 12s
created
neon/phoebe/controllers/database/IndexController.php 1 patch
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function actionEdit($type = null)
56 56
 	{
57
-		if (!$this->canDevelop())
58
-			throw new HttpException(403, 'This operation is not permitted here');
57
+		if (!$this->canDevelop()) {
58
+					throw new HttpException(403, 'This operation is not permitted here');
59
+		}
59 60
 
60 61
 		$form = $this->getPhoebeForm($type, $isNewForm, false, true);
61 62
 		return $this->render('edit-fields', [
@@ -95,9 +96,13 @@  discard block
 block discarded – undo
95 96
 				// register all form field js scripts
96 97
 				$f->registerScripts(neon()->view);
97 98
 				$class = substr($class, 1);
98
-				if (in_array($class, $exclude)) continue;
99
+				if (in_array($class, $exclude)) {
100
+					continue;
101
+				}
99 102
 				$details = $f->getComponentDetails();
100
-				if ($details === false) continue;
103
+				if ($details === false) {
104
+					continue;
105
+				}
101 106
 				$defaultField = Arr::except($f->toArray(), ['dataKey']);
102 107
 				$cmp = Arr::merge($defaultField, [
103 108
 					'class' => $class,
@@ -162,8 +167,9 @@  discard block
 block discarded – undo
162 167
 			]
163 168
 		];
164 169
 		$form = new \neon\core\form\Form($formDefinition);
165
-		if (neon()->request->isAjax)
166
-			return $form->ajaxValidation();
170
+		if (neon()->request->isAjax) {
171
+					return $form->ajaxValidation();
172
+		}
167 173
 		if ($form->processRequest()) {
168 174
 			$data = $form->getData();
169 175
 			$definition = $this->canonicaliseDefinition($data);
Please login to merge, or discard this patch.
neon/cms/form/fields/ImageCompare.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@
 block discarded – undo
51 51
     public function getValueDisplay($context='')
52 52
 	{
53 53
 		$json = $this->getValue();
54
-		if (empty($json))
55
-			return neon()->formatter->asJson($this->getValue());
54
+		if (empty($json)) {
55
+					return neon()->formatter->asJson($this->getValue());
56
+		}
56 57
 		if ($context==='grid') {
57 58
 			$out = '';
58 59
 			foreach($json as $image) {
Please login to merge, or discard this patch.
neon/firefly/services/FileManager.php 1 patch
Braces   +18 added lines, -9 removed lines patch added patch discarded remove patch
@@ -66,7 +66,9 @@  discard block
 block discarded – undo
66 66
 		neon()->firefly->isFileObjectValid($file);
67 67
 		$stream = fopen($file->getRealPath(), 'r+');
68 68
 		$uuid = $this->save($stream, $file->getFilename(), $meta);
69
-		if (is_resource($stream)) fclose($stream);
69
+		if (is_resource($stream)) {
70
+			fclose($stream);
71
+		}
70 72
 		return $uuid;
71 73
 	}
72 74
 
@@ -105,8 +107,9 @@  discard block
 block discarded – undo
105 107
 			->orWhere(['data_type_ref' => 'file_ref_multi'])
106 108
 			->all();
107 109
 			
108
-		if (empty($all))
109
-			return [];
110
+		if (empty($all)) {
111
+					return [];
112
+		}
110 113
 
111 114
 		$q = new Query();
112 115
 		foreach ($all as $i => $field) {
@@ -249,7 +252,9 @@  discard block
 block discarded – undo
249 252
 	public function destroy($uuid)
250 253
 	{
251 254
 		$file = Model::findWithDeleted()->where(['uuid' => $uuid])->one();
252
-		if ($file === null) return false;
255
+		if ($file === null) {
256
+			return false;
257
+		}
253 258
 		return $file->destroy();
254 259
 	}
255 260
 
@@ -332,7 +337,9 @@  discard block
 block discarded – undo
332 337
 			$driver = $this->getDriveFor($uuid, $file);
333 338
 			$hash = $driver->hash($file['path']);
334 339
 			$model = $this->_get($uuid);
335
-			if (!$hash) return false;
340
+			if (!$hash) {
341
+				return false;
342
+			}
336 343
 			$model->file_hash = $hash;
337 344
 			$model->save();
338 345
 		}
@@ -396,8 +403,9 @@  discard block
 block discarded – undo
396 403
 	{
397 404
 		$model = $this->_get($uuid);
398 405
 		$model->attributes = $updates;
399
-		if (!$model->save())
400
-			throw new HttpException(400, $model->getErrors());
406
+		if (!$model->save()) {
407
+					throw new HttpException(400, $model->getErrors());
408
+		}
401 409
 		return $model->toArray();
402 410
 	}
403 411
 
@@ -411,8 +419,9 @@  discard block
 block discarded – undo
411 419
 	public function findFile($drive, $path)
412 420
 	{
413 421
 		$model = Model::find()->where(['drive' => $drive, 'path' => $path])->one();
414
-		if ($model === null)
415
-			return null;
422
+		if ($model === null) {
423
+					return null;
424
+		}
416 425
 		return $model->toArray();
417 426
 	}
418 427
 
Please login to merge, or discard this patch.
neon/firefly/services/ImageManager.php 1 patch
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,11 +38,13 @@  discard block
 block discarded – undo
38 38
 	{
39 39
 		// get firefly image if the source is a firefly id
40 40
 		if (Hash::isUuid64($source)) {
41
-			if (!neon()->firefly->fileManager->exists($source))
42
-				throw new HttpException(404);
41
+			if (!neon()->firefly->fileManager->exists($source)) {
42
+							throw new HttpException(404);
43
+			}
43 44
 			$meta = neon()->firefly->fileManager->getMeta($source);
44
-			if ($meta['mime_type'] == 'image/svg')
45
-				return neon()->firefly->fileManager->read($source);
45
+			if ($meta['mime_type'] == 'image/svg') {
46
+							return neon()->firefly->fileManager->read($source);
47
+			}
46 48
 			$source = neon()->firefly->fileManager->readStream($source);
47 49
 		}
48 50
 		$manager = new InterventionImageManager();
@@ -103,7 +105,9 @@  discard block
 block discarded – undo
103 105
 	public function imageRotate(Image & $image, $params)
104 106
 	{
105 107
 		$rotate = Arr::get($params, 'rotate', false);
106
-		if ($rotate) $image->rotate($rotate);
108
+		if ($rotate) {
109
+			$image->rotate($rotate);
110
+		}
107 111
 	}
108 112
 
109 113
 	/**
Please login to merge, or discard this patch.
neon/firefly/controllers/FileController.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -46,8 +46,9 @@  discard block
 block discarded – undo
46 46
 
47 47
 		// set expiry information on the file
48 48
 		$meta = $firefly->fileManager->getMeta($id);
49
-		if ($meta['mime_type'] == 'image/svg')
50
-			$meta['mime_type'] = 'image/svg+xml';
49
+		if ($meta['mime_type'] == 'image/svg') {
50
+					$meta['mime_type'] = 'image/svg+xml';
51
+		}
51 52
 		$this->sendCacheHeaders($meta['mime_type'], $meta['size'], $meta['updated_at'], md5($request->absoluteUrl), $meta['name']);
52 53
 		$download = $request->get('download', $request->get('dl', false));
53 54
 		try {
@@ -110,7 +111,9 @@  discard block
 block discarded – undo
110 111
 			$processedImage = neon()->firefly->imageManager->process($idOrUrl, neon()->request->get());
111 112
 			$mimeType = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $processedImage);
112 113
 			// svgs don't seem display in browsers without specifically the svg+xml mime type
113
-			if ($mimeType === 'image/svg') $mimeType = 'image/svg+xml';
114
+			if ($mimeType === 'image/svg') {
115
+				$mimeType = 'image/svg+xml';
116
+			}
114 117
 			return [
115 118
 				// recalculate the mime type in case was spoofed
116 119
 				'size' => strlen($processedImage),
Please login to merge, or discard this patch.
neon/core/view/SmartySharedPlugins.php 1 patch
Braces   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -126,7 +126,9 @@  discard block
 block discarded – undo
126 126
 	public function googleCode($params)
127 127
 	{
128 128
 		$id = setting('cms', 'google_code');
129
-		if (empty($id)) return '';
129
+		if (empty($id)) {
130
+			return '';
131
+		}
130 132
 		// if using google tag manager
131 133
 		if (substr($id, 0, 3) === 'GTM') {
132 134
 			$head = <<<HEADJS
@@ -923,7 +925,4 @@  discard block
 block discarded – undo
923 925
 		if (!empty($params['assign'])) {
924 926
 			$smarty->assign($params['assign'], $output);
925 927
 		} else {
926
-			return $output;
927
-		}
928
-	}
929
-}
928
+			return $output
930 929
\ No newline at end of file
Please login to merge, or discard this patch.
neon/cms/components/CmsUrlRule.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@
 block discarded – undo
34 34
 		$url = CmsUrl::find()->where(['url' => $pathInfo])->limit(1)->one();
35 35
 		// if the url is not in the url table then return false to continue processing other route rules
36 36
 		// typically in a neon setup the module/controller/action rule
37
-		if (! $url) return false;
37
+		if (! $url) {
38
+			return false;
39
+		}
38 40
 		// check if the url found represents a redirect
39 41
 		if ($url['redirect'] !== null) {
40 42
 			neon()->response->redirect($url['redirect'], 301)->send();
Please login to merge, or discard this patch.
neon/core/form/fields/ImageMultiple.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,10 +24,12 @@  discard block
 block discarded – undo
24 24
 
25 25
 	public function setValue($value)
26 26
 	{
27
-		if (is_array($value))
28
-			$this->_value = $value;
29
-		if (is_string($value))
30
-			$this->_value = json_decode($value);
27
+		if (is_array($value)) {
28
+					$this->_value = $value;
29
+		}
30
+		if (is_string($value)) {
31
+					$this->_value = json_decode($value);
32
+		}
31 33
 	}
32 34
 
33 35
 	/**
@@ -62,8 +64,9 @@  discard block
 block discarded – undo
62 64
 	public function getValueDisplay($context='')
63 65
 	{
64 66
 		$json = $this->getValue();
65
-		if (empty($json))
66
-			return neon()->formatter->asJson($this->getValue());
67
+		if (empty($json)) {
68
+					return neon()->formatter->asJson($this->getValue());
69
+		}
67 70
 		if ($context==='grid') {
68 71
 			$out = '';
69 72
 			foreach($json as $image) {
Please login to merge, or discard this patch.
neon/core/form/Form.php 1 patch
Braces   +50 added lines, -32 removed lines patch added patch discarded remove patch
@@ -205,11 +205,13 @@  discard block
 block discarded – undo
205 205
 	{
206 206
 		$view = ($view === null) ? $this->getView() : $view;
207 207
 		FormAsset::register($view);
208
-		foreach ($this->getFields() as $field)
209
-			$field->registerScripts($view);
208
+		foreach ($this->getFields() as $field) {
209
+					$field->registerScripts($view);
210
+		}
210 211
 		if ($this->isRootForm()) {
211
-			if ($mount)
212
-				$view->registerJs('(new Vue()).$mount("#' . $this->id . '");', $view::POS_END, $this->id . 'vue');
212
+			if ($mount) {
213
+							$view->registerJs('(new Vue()).$mount("#' . $this->id . '");', $view::POS_END, $this->id . 'vue');
214
+			}
213 215
 		}
214 216
 	}
215 217
 
@@ -333,8 +335,9 @@  discard block
 block discarded – undo
333 335
 	{
334 336
 		$errors = [];
335 337
 		foreach($this->getFields() as $name => $field) {
336
-			if ($field->hasError())
337
-				$errors[$name] = $field->getErrors();
338
+			if ($field->hasError()) {
339
+							$errors[$name] = $field->getErrors();
340
+			}
338 341
 		}
339 342
 		return array_merge($this->_errors, $errors);
340 343
 	}
@@ -363,10 +366,11 @@  discard block
 block discarded – undo
363 366
 	 */
364 367
 	public function addError($fieldNameOrError='', $error=null)
365 368
 	{
366
-		if ($error === null)
367
-			$this->_errors[] = $fieldNameOrError;
368
-		else
369
-			$this->getField($fieldNameOrError)->addError($error);
369
+		if ($error === null) {
370
+					$this->_errors[] = $fieldNameOrError;
371
+		} else {
372
+					$this->getField($fieldNameOrError)->addError($error);
373
+		}
370 374
 	}
371 375
 
372 376
 // ============================================================================
@@ -460,8 +464,9 @@  discard block
 block discarded – undo
460 464
 		// multiple versions of the same form can exist on a page
461 465
 		// in these scenarios the forms each can have different root form ids.
462 466
 		$bits = explode('.', $path);
463
-		if (!($bits[0] === $this->name || ($this->isRootForm() && $bits[0] === $this->id)))
464
-			throw new \Exception("The first part of the path should be the form name or the id if this is a root form. The forms name and id is: name={$this->name}, id={$this->id}. The path you used was: path=$path.");
467
+		if (!($bits[0] === $this->name || ($this->isRootForm() && $bits[0] === $this->id))) {
468
+					throw new \Exception("The first part of the path should be the form name or the id if this is a root form. The forms name and id is: name={$this->name}, id={$this->id}. The path you used was: path=$path.");
469
+		}
465 470
 		// remove first item and reindex array : note unset does not update array indexes
466 471
 		array_splice($bits, 0, 1);
467 472
 		$field = $this->getField($bits[0]);
@@ -495,8 +500,9 @@  discard block
 block discarded – undo
495 500
 	public function getFields($names=null)
496 501
 	{
497 502
 		$this->orderFields();
498
-		if ($names === null)
499
-			return $this->_fields;
503
+		if ($names === null) {
504
+					return $this->_fields;
505
+		}
500 506
 
501 507
 		return Arr::only($this->_fields, $names);
502 508
 	}
@@ -818,9 +824,12 @@  discard block
 block discarded – undo
818 824
 	{
819 825
 		$data = [];
820 826
 		foreach ($this->getFields() as $field) {
821
-			if ($field->deleted) continue;
822
-			if ($field->getIsInput())
823
-				$data[$field->getDataKey()] = $field->getData();
827
+			if ($field->deleted) {
828
+				continue;
829
+			}
830
+			if ($field->getIsInput()) {
831
+							$data[$field->getDataKey()] = $field->getData();
832
+			}
824 833
 		}
825 834
 		return $data;
826 835
 	}
@@ -834,8 +843,9 @@  discard block
 block discarded – undo
834 843
 	{
835 844
 		$data = [];
836 845
 		foreach ($this->getFields() as $field) {
837
-			if ($field->getIsInput())
838
-				$data[$field->getName()] = $field->getValueDisplay();
846
+			if ($field->getIsInput()) {
847
+							$data[$field->getName()] = $field->getValueDisplay();
848
+			}
839 849
 		}
840 850
 		return $data;
841 851
 	}
@@ -848,8 +858,9 @@  discard block
 block discarded – undo
848 858
 	 */
849 859
 	public function getDataKey()
850 860
 	{
851
-		if ($this->_dataKey !== null)
852
-			return $this->_dataKey;
861
+		if ($this->_dataKey !== null) {
862
+					return $this->_dataKey;
863
+		}
853 864
 		return $this->getName();
854 865
 	}
855 866
 
@@ -880,8 +891,9 @@  discard block
 block discarded – undo
880 891
 	 */
881 892
 	public function getId($autoGenerate=false)
882 893
 	{
883
-		if ($this->_id)
884
-			return $this->_id;
894
+		if ($this->_id) {
895
+					return $this->_id;
896
+		}
885 897
 		return $this->getName();
886 898
 	}
887 899
 
@@ -915,8 +927,9 @@  discard block
 block discarded – undo
915 927
 		$value = [];
916 928
 		foreach ($this->getFields() as $field) {
917 929
 			if (!$field->deleted) {
918
-				if ($field->getIsInput())
919
-					$value[$field->getDataKey()] = $field->getValue();
930
+				if ($field->getIsInput()) {
931
+									$value[$field->getDataKey()] = $field->getValue();
932
+				}
920 933
 			}
921 934
 		}
922 935
 		return $value;
@@ -1145,8 +1158,9 @@  discard block
 block discarded – undo
1145 1158
 		foreach ($this->getFields() as $key => $field) {
1146 1159
 			$fieldDefinition = $field->exportDefinition();
1147 1160
 
1148
-			if (! is_null($field->ddsDataType) && ! is_null($fieldDefinition) )
1149
-				$fields[$key] = $fieldDefinition;
1161
+			if (! is_null($field->ddsDataType) && ! is_null($fieldDefinition) ) {
1162
+							$fields[$key] = $fieldDefinition;
1163
+			}
1150 1164
 		}
1151 1165
 		$formDefinition['definition']['fields'] = $fields;
1152 1166
 		return $formDefinition;
@@ -1257,8 +1271,9 @@  discard block
 block discarded – undo
1257 1271
 	 */
1258 1272
 	public function getRequest()
1259 1273
 	{
1260
-		if ($this->_request === null)
1261
-			$this->_request = neon()->request;
1274
+		if ($this->_request === null) {
1275
+					$this->_request = neon()->request;
1276
+		}
1262 1277
 		return $this->_request;
1263 1278
 	}
1264 1279
 
@@ -1277,8 +1292,9 @@  discard block
 block discarded – undo
1277 1292
 	 */
1278 1293
 	public function reset()
1279 1294
 	{
1280
-		foreach($this->getFields() as $field)
1281
-			$field->reset();
1295
+		foreach($this->getFields() as $field) {
1296
+					$field->reset();
1297
+		}
1282 1298
 	}
1283 1299
 
1284 1300
 	/**
@@ -1298,7 +1314,9 @@  discard block
 block discarded – undo
1298 1314
 		$fake = [];
1299 1315
 		foreach($this->getFields() as $key => $field) {
1300 1316
 			$val = $field->fake();
1301
-			if (empty($val)) continue;
1317
+			if (empty($val)) {
1318
+				continue;
1319
+			}
1302 1320
 			$fake[$key] = $val;
1303 1321
 		}
1304 1322
 		return $fake;
Please login to merge, or discard this patch.