Passed
Push — develop ( 29faa4...07e7ff )
by Neill
33:04 queued 19:04
created
neon/phoebe/services/adapters/daedalus/PhoebeObject.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,8 +36,9 @@  discard block
 block discarded – undo
36 36
 	public function setDataSources($sources)
37 37
 	{
38 38
 		foreach ($sources as $key=>$value) {
39
-			if (empty($value))
40
-				unset($sources[$key]);
39
+			if (empty($value)) {
40
+							unset($sources[$key]);
41
+			}
41 42
 		}
42 43
 		$this->dataSources = $sources;
43 44
 	}
@@ -114,8 +115,9 @@  discard block
 block discarded – undo
114 115
 	 */
115 116
 	protected function ddo()
116 117
 	{
117
-		if ($this->_ddo == null)
118
-			$this->_ddo = neon('dds')->IDdsObjectManagement;
118
+		if ($this->_ddo == null) {
119
+					$this->_ddo = neon('dds')->IDdsObjectManagement;
120
+		}
119 121
 		return $this->_ddo;
120 122
 	}
121 123
 
Please login to merge, or discard this patch.
neon/phoebe/services/adapters/daedalus/PhoebeClass.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	public function editClass($changes)
56 56
 	{
57 57
 		if (!is_array($changes))
58
-			throw new \RuntimeException('You should pass an array into editClass. You passed in '.print_r($changes,true));
58
+			throw new \RuntimeException('You should pass an array into editClass. You passed in '.print_r($changes, true));
59 59
 
60 60
 		// make the appropriate changes to dds. Any unknown fields are ignored
61 61
 		$this->dds()->editClass($this->classType, $changes);
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
 		foreach ($fields as $k => $f) {
74 74
 			// map some form to Phoebe differences
75
-			$f['link_class'] = (!empty($f['linkClass']) ? $f['linkClass'] : null);  // named differently
75
+			$f['link_class'] = (!empty($f['linkClass']) ? $f['linkClass'] : null); // named differently
76 76
 			// extract the definition for saving in phoebe
77 77
 			$definition = $f['definition'];
78 78
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
 		// and save to phoebe - remove unallowed phoebe values for Daedalus tables
123 123
 		$changes = array_diff_key($changes, array_flip(['version', 'volatile', 'object_history', 'version_locked']));
124
-		if (count($changes)==0)
124
+		if (count($changes) == 0)
125 125
 			return;
126 126
 		$hasChanges = parent::editClass($changes);
127 127
 		return $hasChanges;
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	/** --------------------------------------- **/
162 162
 	/** -------- Class Override Methods ------- **/
163 163
 
164
-	public function addOverride($label, $selector='', $activeFrom=null, $activeTo=null, $isActive=true)
164
+	public function addOverride($label, $selector = '', $activeFrom = null, $activeTo = null, $isActive = true)
165 165
 	{
166 166
 		throw new \RuntimeException("Overrides are not available for Daedalus tables");
167 167
 	}
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 	 *   reordering the form in the process
194 194
 	 * @return array
195 195
 	 */
196
-	protected function getDefinitionAsForm($excludeDeletedFields=true, array $restrictToFields=[])
196
+	protected function getDefinitionAsForm($excludeDeletedFields = true, array $restrictToFields = [])
197 197
 	{
198 198
 		$fields = [];
199 199
 		$definition = $this->definition;
Please login to merge, or discard this patch.
Braces   +29 added lines, -20 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function editClass($changes)
56 56
 	{
57
-		if (!is_array($changes))
58
-			throw new \RuntimeException('You should pass an array into editClass. You passed in '.print_r($changes,true));
57
+		if (!is_array($changes)) {
58
+					throw new \RuntimeException('You should pass an array into editClass. You passed in '.print_r($changes,true));
59
+		}
59 60
 
60 61
 		// make the appropriate changes to dds. Any unknown fields are ignored
61 62
 		$this->dds()->editClass($this->classType, $changes);
@@ -108,10 +109,11 @@  discard block
 block discarded – undo
108 109
 			if ($f['mapField'] == 1 && $currentData['map_field'] == 0) {
109 110
 				$this->dds()->setMemberAsMapField($this->classType, $memberRef);
110 111
 			}
111
-			if ($definition['deleted'] == 1 && $currentData['deleted'] == 0)
112
-				$this->dds()->deleteMember($this->classType, $memberRef);
113
-			else if ($definition['deleted'] == 0 && $currentData['deleted'] == 1)
114
-				$this->dds()->undeleteMember($this->classType, $memberRef);
112
+			if ($definition['deleted'] == 1 && $currentData['deleted'] == 0) {
113
+							$this->dds()->deleteMember($this->classType, $memberRef);
114
+			} else if ($definition['deleted'] == 0 && $currentData['deleted'] == 1) {
115
+							$this->dds()->undeleteMember($this->classType, $memberRef);
116
+			}
115 117
 			if ($definition['deleted'] == -1) {
116 118
 				// remove definition from phoebe
117 119
 				unset($changes['definition']['fields'][$k]);
@@ -121,8 +123,9 @@  discard block
 block discarded – undo
121 123
 
122 124
 		// and save to phoebe - remove unallowed phoebe values for Daedalus tables
123 125
 		$changes = array_diff_key($changes, array_flip(['version', 'volatile', 'object_history', 'version_locked']));
124
-		if (count($changes)==0)
125
-			return;
126
+		if (count($changes)==0) {
127
+					return;
128
+		}
126 129
 		$hasChanges = parent::editClass($changes);
127 130
 		return $hasChanges;
128 131
 	}
@@ -132,8 +135,9 @@  discard block
 block discarded – undo
132 135
 	 */
133 136
 	public function deleteClass()
134 137
 	{
135
-		if (($result = parent::deleteClass()))
136
-			$this->dds()->deleteClass($this->classType);
138
+		if (($result = parent::deleteClass())) {
139
+					$this->dds()->deleteClass($this->classType);
140
+		}
137 141
 		return $result;
138 142
 	}
139 143
 
@@ -142,8 +146,9 @@  discard block
 block discarded – undo
142 146
 	 */
143 147
 	public function undeleteClass()
144 148
 	{
145
-		if (($result = parent::undeleteClass()))
146
-			$this->dds()->undeleteClass($this->classType);
149
+		if (($result = parent::undeleteClass())) {
150
+					$this->dds()->undeleteClass($this->classType);
151
+		}
147 152
 		return $result;
148 153
 	}
149 154
 
@@ -152,8 +157,9 @@  discard block
 block discarded – undo
152 157
 	 */
153 158
 	public function destroyClass()
154 159
 	{
155
-		if (($result = parent::destroyClass()))
156
-			$this->dds()->destroyClass($this->classType);
160
+		if (($result = parent::destroyClass())) {
161
+					$this->dds()->destroyClass($this->classType);
162
+		}
157 163
 		return $result;
158 164
 	}
159 165
 
@@ -199,8 +205,9 @@  discard block
 block discarded – undo
199 205
 		$definition = $this->definition;
200 206
 		$order = 0;
201 207
 		$restrictFields = count($restrictToFields) > 0;
202
-		if ($restrictFields)
203
-			$restrictFieldPostion = array_flip($restrictToFields);
208
+		if ($restrictFields) {
209
+					$restrictFieldPostion = array_flip($restrictToFields);
210
+		}
204 211
 		if (isset($definition['fields'])) {
205 212
 			$fields = $definition['fields'];
206 213
 			foreach ($fields as $key=>$field) {
@@ -215,8 +222,9 @@  discard block
 block discarded – undo
215 222
 				if (isset($field['definition'])) {
216 223
 					$fields[$key] = $field['definition'];
217 224
 					$fields[$key]['mapField'] = $field['mapField'];
218
-					if (isset($field['deleted']))
219
-						$fields[$key]['deleted'] = $field['deleted'];
225
+					if (isset($field['deleted'])) {
226
+											$fields[$key]['deleted'] = $field['deleted'];
227
+					}
220 228
 					// TODO - 20180522 NJ
221 229
 					// THIS WILL GO WRONG WITH DELETED FIELDS WHERE FINAL SUBMIT BUTTON MAY BE IN WRONG PLACE
222 230
 					$fields[$key]['order'] = ($restrictFields ? ($restrictFieldPostion[$key]) : $order++);
@@ -232,8 +240,9 @@  discard block
 block discarded – undo
232 240
 	protected $_dds = null;
233 241
 	protected function dds()
234 242
 	{
235
-		if ($this->_dds == null)
236
-			$this->_dds = neon('dds')->iDdsClassManagement;
243
+		if ($this->_dds == null) {
244
+					$this->_dds = neon('dds')->iDdsClassManagement;
245
+		}
237 246
 		return $this->_dds;
238 247
 	}
239 248
 
Please login to merge, or discard this patch.
neon/phoebe/services/adapters/daedalus/PhoebeType.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * Set this up as a daedalus type
48 48
 	 * @param array $config
49 49
 	 */
50
-	public function __construct($config=[])
50
+	public function __construct($config = [])
51 51
 	{
52 52
 		$path = '\neon\phoebe\services\adapters\daedalus';
53 53
 		$config['phoebeType'] = 'daedalus';
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
 	/** ------------ Class Methods ----------- **/
96 96
 
97
-	public function listClasses(&$paginator=[], $filters=[], $orderBy=[], $includeDeleted=false)
97
+	public function listClasses(&$paginator = [], $filters = [], $orderBy = [], $includeDeleted = false)
98 98
 	{
99 99
 		$classes = parent::listClasses($paginator, $filters, $orderBy, $includeDeleted);
100 100
 		$this->mergeDaedalusFields($classes);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	/**
105 105
 	 * @inheritdoc
106 106
 	 */
107
-	public function addClass(&$classType, $module='')
107
+	public function addClass(&$classType, $module = '')
108 108
 	{
109 109
 		$classType = $this->canonicaliseRef($classType);
110 110
 		$class = parent::addClass($classType, $module);
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	/**
128 128
 	 * @inheritdoc
129 129
 	 */
130
-	public function listObjects($classType, &$paginator=[], $filters=[], $orderBy=[], $additionalFields=[])
130
+	public function listObjects($classType, &$paginator = [], $filters = [], $orderBy = [], $additionalFields = [])
131 131
 	{
132 132
 		$filters = null;
133 133
 		// get our data directly from daedalus - objects are not stored in phoebe
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	/**
150 150
 	 * @inheritdoc
151 151
 	 */
152
-	public function addObject($classType, $overrideCriteria=[])
152
+	public function addObject($classType, $overrideCriteria = [])
153 153
 	{
154 154
 		// Daedalus doesn't manage overrides currently
155 155
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 				$classes[$ct]['count_current'] = 0;
210 210
 				$classTypes[] = $ct;
211 211
 			}
212
-			$query = "SELECT * FROM dds_class WHERE `class_type` IN ('".implode("','",$classTypes)."')";
212
+			$query = "SELECT * FROM dds_class WHERE `class_type` IN ('".implode("','", $classTypes)."')";
213 213
 			$counts = neon()->db->createCommand($query)->queryAll();
214 214
 			foreach ($counts as $c) {
215 215
 				$classes[$c['class_type']] = array_merge($classes[$c['class_type']], $c);
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -65,8 +65,9 @@  discard block
 block discarded – undo
65 65
 		$class = $this->canonicaliseRef($class);
66 66
 
67 67
 		// descriptions of a class are stored as hints in the form
68
-		if (isset($definition['description']))
69
-			$definition['hint'] = $definition['description'];
68
+		if (isset($definition['description'])) {
69
+					$definition['hint'] = $definition['description'];
70
+		}
70 71
 
71 72
 		// pass the definition to a form object and then get back the full definition
72 73
 		$definition['name'] = $class;
@@ -78,8 +79,9 @@  discard block
 block discarded – undo
78 79
 
79 80
 		// save the class information
80 81
 		$phoebeClass = $this->getClass($class);
81
-		if (!$phoebeClass)
82
-			$phoebeClass = $this->addClass($class, $module);
82
+		if (!$phoebeClass) {
83
+					$phoebeClass = $this->addClass($class, $module);
84
+		}
83 85
 		$phoebeClass->editClass($classDefinition);
84 86
 
85 87
 		// close the migration
@@ -159,8 +161,9 @@  discard block
 block discarded – undo
159 161
 		$ddsObject = $this->ddo()->getObject($objectId);
160 162
 
161 163
 		$object = $objectId ? $this->createFauxIPhoebeObject($classType, $objectId, $ddsObject) : null;
162
-		if ($object)
163
-			$object->changeLogUuid = $changeLogUuid;
164
+		if ($object) {
165
+					$object->changeLogUuid = $changeLogUuid;
166
+		}
164 167
 		return $object;
165 168
 	}
166 169
 
@@ -221,16 +224,18 @@  discard block
 block discarded – undo
221 224
 	protected $_dds = null;
222 225
 	protected function dds()
223 226
 	{
224
-		if ($this->_dds == null)
225
-			$this->_dds = neon('dds')->IDdsClassManagement;
227
+		if ($this->_dds == null) {
228
+					$this->_dds = neon('dds')->IDdsClassManagement;
229
+		}
226 230
 		return $this->_dds;
227 231
 	}
228 232
 
229 233
 	protected $_ddo = null;
230 234
 	protected function ddo()
231 235
 	{
232
-		if ($this->_ddo == null)
233
-			$this->_ddo = neon('dds')->IDdsObjectManagement;
236
+		if ($this->_ddo == null) {
237
+					$this->_ddo = neon('dds')->IDdsObjectManagement;
238
+		}
234 239
 		return $this->_ddo;
235 240
 	}
236 241
 
Please login to merge, or discard this patch.
neon/phoebe/services/adapters/basic/PhoebeClass.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
 	/**
19 19
 	 * @inheritdoc
20 20
 	 */
21
-	public function getClassFormDefinition(array $fields=[])
21
+	public function getClassFormDefinition(array $fields = [])
22 22
 	{
23 23
 		return [];
24 24
 	}
Please login to merge, or discard this patch.
neon/phoebe/services/adapters/basic/PhoebeType.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
  */
15 15
 class PhoebeType extends PhoebeTypeBase
16 16
 {
17
-	public function __construct($config=[])
17
+	public function __construct($config = [])
18 18
 	{
19 19
 		$path = '\neon\phoebe\services\adapters\basic';
20 20
 		$config['phoebeType'] = 'basic';
Please login to merge, or discard this patch.
neon/phoebe/plugins/smarty/function.appForm.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	$appForm = 'applicationForm';
107 107
 	// process the parameters
108 108
 	if (!isset($params['classType']))
109
-		throw new \RuntimeException("You must pass in the form's classType otherwise we don't which form it is. You passed in: ".print_r($params,true));
109
+		throw new \RuntimeException("You must pass in the form's classType otherwise we don't which form it is. You passed in: ".print_r($params, true));
110 110
 	$classType = $params['classType'];
111 111
 	$uuid = !empty($params['uuid']) ? $params['uuid'] : null;
112 112
 	$id = !empty($params['id']) ? $params['id'] : null;
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
 	$assignForm = !empty($params['assignForm']) ? $params['assignForm'] : 'form';
119 119
 	$assignSubmitted = !empty($params['assignSubmitted']) ? $params['assignSubmitted'] : 'submitted';
120 120
 	$dataSources = !empty($params['dataSources']) ? $params['dataSources'] : [];
121
-	$readOnly = isset($params['readOnly']) ? (bool)$params['readOnly'] : false;
122
-	$printOnly = isset($params['printOnly']) ? (bool)$params['printOnly'] : false;
123
-	$enableAjaxValidation = isset($params['enableAjaxValidation']) ? (bool)$params['enableAjaxValidation'] : true;
124
-	$enableAjaxSubmission = isset($params['enableAjaxSubmission']) ? (bool)$params['enableAjaxSubmission'] : false;
121
+	$readOnly = isset($params['readOnly']) ? (bool) $params['readOnly'] : false;
122
+	$printOnly = isset($params['printOnly']) ? (bool) $params['printOnly'] : false;
123
+	$enableAjaxValidation = isset($params['enableAjaxValidation']) ? (bool) $params['enableAjaxValidation'] : true;
124
+	$enableAjaxSubmission = isset($params['enableAjaxSubmission']) ? (bool) $params['enableAjaxSubmission'] : false;
125 125
 	$ajaxValidationUrl = !empty($params['ajaxValidationUrl']) ? $params['ajaxValidationUrl'] : '/phoebe/appforms/index/validate-form';
126 126
 	$initialiseFromDds = !empty($params['initialiseFromDds']) ? $params['initialiseFromDds'] : null;
127 127
 	//$mapFilters = !empty($params['mapFilters']) ? $params['mapFilters'] : [];
@@ -141,14 +141,14 @@  discard block
 block discarded – undo
141 141
 	$requiredDataSources = array_keys($class->getRequiredDataSources());
142 142
 	$missingDataSources = array_diff($requiredDataSources, array_keys($dataSources));
143 143
 	if (count($missingDataSources)) {
144
-		throw new \RuntimeException('Error - you need to provide uuids for the following classes: '.implode(', ',$missingDataSources));
144
+		throw new \RuntimeException('Error - you need to provide uuids for the following classes: '.implode(', ', $missingDataSources));
145 145
 	}
146 146
 
147 147
 	// prefix invalid (HTML5) ids with a letter
148 148
 	$id = ($id ? $id : ($uuid ? $uuid : null));
149 149
 	if ($id) {
150 150
 		if (is_numeric($id[0]) || $id[0] == '-' || $id[0] == '_')
151
-			$id = 'z' . $id;
151
+			$id = 'z'.$id;
152 152
 	}
153 153
 
154 154
 	// get hold of the form definition
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -105,8 +105,9 @@  discard block
 block discarded – undo
105 105
 
106 106
 	$appForm = 'applicationForm';
107 107
 	// process the parameters
108
-	if (!isset($params['classType']))
109
-		throw new \RuntimeException("You must pass in the form's classType otherwise we don't which form it is. You passed in: ".print_r($params,true));
108
+	if (!isset($params['classType'])) {
109
+			throw new \RuntimeException("You must pass in the form's classType otherwise we don't which form it is. You passed in: ".print_r($params,true));
110
+	}
110 111
 	$classType = $params['classType'];
111 112
 	$uuid = !empty($params['uuid']) ? $params['uuid'] : null;
112 113
 	$id = !empty($params['id']) ? $params['id'] : null;
@@ -135,8 +136,9 @@  discard block
 block discarded – undo
135 136
 		$class = $phoebe->getClass($classType);
136 137
 		$appFormClasses[$classType] = $class;
137 138
 	}
138
-	if (!$class)
139
-		throw new \RuntimeException('Error - cannot get hold of the form class '.$classType);
139
+	if (!$class) {
140
+			throw new \RuntimeException('Error - cannot get hold of the form class '.$classType);
141
+	}
140 142
 
141 143
 	$requiredDataSources = array_keys($class->getRequiredDataSources());
142 144
 	$missingDataSources = array_diff($requiredDataSources, array_keys($dataSources));
@@ -147,8 +149,9 @@  discard block
 block discarded – undo
147 149
 	// prefix invalid (HTML5) ids with a letter
148 150
 	$id = ($id ? $id : ($uuid ? $uuid : null));
149 151
 	if ($id) {
150
-		if (is_numeric($id[0]) || $id[0] == '-' || $id[0] == '_')
151
-			$id = 'z' . $id;
152
+		if (is_numeric($id[0]) || $id[0] == '-' || $id[0] == '_') {
153
+					$id = 'z' . $id;
154
+		}
152 155
 	}
153 156
 
154 157
 	// get hold of the form definition
@@ -185,8 +188,9 @@  discard block
 block discarded – undo
185 188
 	} else if ($uuid) {
186 189
 		$phoebe = neon('phoebe')->getIPhoebeType($appForm);
187 190
 		$object = $phoebe->getObject($uuid);
188
-		if (!$object)
189
-			throw new \yii\web\NotFoundHttpException('The requested form was not found. Uuid='.$uuid);
191
+		if (!$object) {
192
+					throw new \yii\web\NotFoundHttpException('The requested form was not found. Uuid='.$uuid);
193
+		}
190 194
 		$appFormObjects[$uuid] = $object;
191 195
 	}
192 196
 	$template->assign($assignSubmitted, false);
Please login to merge, or discard this patch.
neon/phoebe/controllers/appforms/IndexController.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * Start the appForm Builder for this class
63 63
 	 * @param string $type  the class type of the object required
64 64
 	 */
65
-	public function actionEdit($type=null)
65
+	public function actionEdit($type = null)
66 66
 	{
67 67
 		if (!$this->canDevelop())
68 68
 			throw new \HttpException(403, 'This operation is not permitted here');
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		$grid = new \neon\core\grid\PhoebeGrid([
123 123
 			'phoebeType'=>$this->phoebeType,
124 124
 			'classType'=>$type,
125
-			'additionalColumns' => ['data','deleted']
125
+			'additionalColumns' => ['data', 'deleted']
126 126
 		]);
127 127
 		return $this->render('list', [
128 128
 			'grid' => $grid,
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @param string $type the applicationForm class type the object belongs to
138 138
 	 * @param string $id the Object id
139 139
 	 */
140
-	public function actionDeleteObject($type, $id, $redirect=true)
140
+	public function actionDeleteObject($type, $id, $redirect = true)
141 141
 	{
142 142
 		$this->deleteObject($id);
143 143
 		if ($redirect)
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	 * @param type $classType
151 151
 	 * @return type
152 152
 	 */
153
-	public function actionValidateForm($classType, $name=null)
153
+	public function actionValidateForm($classType, $name = null)
154 154
 	{
155 155
 		return PhoebeValidator::validateForm('applicationForm', $classType, $name);
156 156
 	}
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -64,8 +64,9 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	public function actionEdit($type=null)
66 66
 	{
67
-		if (!$this->canDevelop())
68
-			throw new \HttpException(403, 'This operation is not permitted here');
67
+		if (!$this->canDevelop()) {
68
+					throw new \HttpException(403, 'This operation is not permitted here');
69
+		}
69 70
 
70 71
 		$builderDefinition = $this->getBuilderDefinition($type);
71 72
 		$isNew = ($type === null || count($builderDefinition) == 0);
@@ -140,8 +141,9 @@  discard block
 block discarded – undo
140 141
 	public function actionDeleteObject($type, $id, $redirect=true)
141 142
 	{
142 143
 		$this->deleteObject($id);
143
-		if ($redirect)
144
-			$this->redirect([$this->baseUrl.'list-objects', 'type' => $type]);
144
+		if ($redirect) {
145
+					$this->redirect([$this->baseUrl.'list-objects', 'type' => $type]);
146
+		}
145 147
 		return '';
146 148
 	}
147 149
 
@@ -188,11 +190,13 @@  discard block
 block discarded – undo
188 190
 	public function actionEditObject($type, $id)
189 191
 	{
190 192
 		$form = $this->getPhoebeForm($type);
191
-		if (neon()->request->getIsAjax())
192
-			return $form->ajaxValidation();
193
+		if (neon()->request->getIsAjax()) {
194
+					return $form->ajaxValidation();
195
+		}
193 196
 		$object = $this->getObject($id);
194
-		if (!$object)
195
-			throw new NotFoundHttpException('The requested form was not found');
197
+		if (!$object) {
198
+					throw new NotFoundHttpException('The requested form was not found');
199
+		}
196 200
 		if ($form->processRequest()) {
197 201
 			$object->editObject($form->getData());
198 202
 			$this->redirect([$this->baseUrl.'list-objects', 'type'=>$type]);
Please login to merge, or discard this patch.
neon/phoebe/controllers/appforms/api/FormController.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		// temporary hack to sort out uuids being passed in rather than
42 42
 		// a human readable definition.
43 43
 		if ($this->is_uuid($class))
44
-			$class=str_replace(['-','_'], ['a','Z'],Hash::uuid2uuid64($class));
44
+			$class = str_replace(['-', '_'], ['a', 'Z'], Hash::uuid2uuid64($class));
45 45
 		else
46 46
 			$class = $phoebe->canonicaliseRef($class);
47 47
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		// close the migration
66 66
 		$this->endMigration();
67 67
 
68
-		$phoebeClass =  $phoebe->getClass($class);
68
+		$phoebeClass = $phoebe->getClass($class);
69 69
 		if ($phoebeClass == null) {
70 70
 			$phoebeClass = ['error' => "No class exists with a type of '$class'"];
71 71
 		}
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	private function is_uuid($str)
83 83
 	{
84
-		return (strlen($str)==36 && substr_count($str, '-')==4);
84
+		return (strlen($str) == 36 && substr_count($str, '-') == 4);
85 85
 	}
86 86
 
87 87
 	/**
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,10 +40,11 @@  discard block
 block discarded – undo
40 40
 
41 41
 		// temporary hack to sort out uuids being passed in rather than
42 42
 		// a human readable definition.
43
-		if ($this->is_uuid($class))
44
-			$class=str_replace(['-','_'], ['a','Z'],Hash::uuid2uuid64($class));
45
-		else
46
-			$class = $phoebe->canonicaliseRef($class);
43
+		if ($this->is_uuid($class)) {
44
+					$class=str_replace(['-','_'], ['a','Z'],Hash::uuid2uuid64($class));
45
+		} else {
46
+					$class = $phoebe->canonicaliseRef($class);
47
+		}
47 48
 
48 49
 		$definition = neon()->request->getBodyParams();
49 50
 		if (!isset($definition['name'])) {
@@ -55,8 +56,9 @@  discard block
 block discarded – undo
55 56
 
56 57
 		// save the class information
57 58
 		$phoebeClass = $phoebe->getClass($class);
58
-		if (!$phoebeClass)
59
-			$phoebeClass = $phoebe->addClass($class, 'phoebe');
59
+		if (!$phoebeClass) {
60
+					$phoebeClass = $phoebe->addClass($class, 'phoebe');
61
+		}
60 62
 		$phoebeClass->editClass([
61 63
 			'definition' => $definition,
62 64
 			'label' => $definition['name']
Please login to merge, or discard this patch.
neon/phoebe/controllers/common/PhoebeController.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 	 * @param string $type the phoebe class type
53 53
 	 * @return \neon\core\form\Form
54 54
 	 */
55
-	protected function getPhoebeForm($type, &$isNewForm=null, $addExtras=true, $builder=false)
55
+	protected function getPhoebeForm($type, &$isNewForm = null, $addExtras = true, $builder = false)
56 56
 	{
57 57
 		$form = null;
58 58
 		$isNewForm = false;
Please login to merge, or discard this patch.
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -61,8 +61,9 @@  discard block
 block discarded – undo
61 61
 			$class = $this->getClass($type);
62 62
 			if ($builder) {
63 63
 				$definition = $class->getClassBuilderDefinition();
64
-			} else
65
-				$definition = $class->getClassFormDefinition();
64
+			} else {
65
+							$definition = $class->getClassFormDefinition();
66
+			}
66 67
 			$fieldCount = count($definition['fields']);
67 68
 			$isNewForm = count($definition) == 0 ? true : false;
68 69
 			$form = new \neon\core\form\Form($definition);
@@ -114,8 +115,9 @@  discard block
 block discarded – undo
114 115
 	protected function getBuilderDefinition($classType)
115 116
 	{
116 117
 		$class = null;
117
-		if ($classType)
118
-			$class = $this->getClass($classType);
118
+		if ($classType) {
119
+					$class = $this->getClass($classType);
120
+		}
119 121
 		return $class ? $class->getClassBuilderDefinition() : [];
120 122
 	}
121 123
 
@@ -127,8 +129,9 @@  discard block
 block discarded – undo
127 129
 	protected function getClassDefinition($classType)
128 130
 	{
129 131
 		$class = null;
130
-		if ($classType)
131
-			$class = $this->getClass($classType);
132
+		if ($classType) {
133
+					$class = $this->getClass($classType);
134
+		}
132 135
 		return $class ? $class->definition : [];
133 136
 	}
134 137
 
@@ -151,8 +154,9 @@  discard block
 block discarded – undo
151 154
 	protected function getObject($id)
152 155
 	{
153 156
 		$object = $this->phoebe()->getObject($id);
154
-		if (!$object)
155
-			throw new \yii\web\HttpException(404);
157
+		if (!$object) {
158
+					throw new \yii\web\HttpException(404);
159
+		}
156 160
 		return $object;
157 161
 	}
158 162
 
@@ -164,8 +168,9 @@  discard block
 block discarded – undo
164 168
 	protected function deleteObject($id)
165 169
 	{
166 170
 		$object = $this->phoebe()->getObject($id);
167
-		if ($object)
168
-			return $object->deleteObject();
171
+		if ($object) {
172
+					return $object->deleteObject();
173
+		}
169 174
 		return null;
170 175
 	}
171 176
 
@@ -177,8 +182,9 @@  discard block
 block discarded – undo
177 182
 	protected function undeleteObject($id)
178 183
 	{
179 184
 		$object = $this->phoebe()->getObject($id);
180
-		if ($object)
181
-			return $object->undeleteObject();
185
+		if ($object) {
186
+					return $object->undeleteObject();
187
+		}
182 188
 		return null;
183 189
 	}
184 190
 
@@ -190,8 +196,9 @@  discard block
 block discarded – undo
190 196
 	protected function destroyObject($id)
191 197
 	{
192 198
 		$object = $this->phoebe()->getObject($id);
193
-		if ($object)
194
-			return $object->destroyObject();
199
+		if ($object) {
200
+					return $object->destroyObject();
201
+		}
195 202
 		return null;
196 203
 	}
197 204
 }
Please login to merge, or discard this patch.