Passed
Push — develop ( 7bdbd7...e398eb )
by Neill
33:33 queued 15s
created
neon/phoebe/services/adapters/daedalus/PhoebeClass.php 1 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 1 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/plugins/smarty/function.appForm.php 1 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/plugins/smarty/function.ddsForm.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -144,8 +144,9 @@  discard block
 block discarded – undo
144 144
 	$phoebeType = 'daedalus';
145 145
 
146 146
 	// process the parameters
147
-	if (!isset($params['classType']))
148
-		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));
147
+	if (!isset($params['classType'])) {
148
+			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));
149
+	}
149 150
 	$classType = $params['classType'];
150 151
 	$label = isset($params['label']) ? $params['label'] : null;
151 152
 	$id = !empty($params['id']) ? $params['id'] : null;
@@ -173,8 +174,9 @@  discard block
 block discarded – undo
173 174
 	// prefix invalid (HTML5) ids with a letter
174 175
 	$id = ($id ? $id : ($uuid ? $uuid : null));
175 176
 	if ($id) {
176
-		if (is_numeric($id[0]) || $id[0] == '-' || $id[0] == '_')
177
-			$id = 'z' . $id;
177
+		if (is_numeric($id[0]) || $id[0] == '-' || $id[0] == '_') {
178
+					$id = 'z' . $id;
179
+		}
178 180
 	}
179 181
 	$changeLogUuids = [];
180 182
 
@@ -243,8 +245,9 @@  discard block
 block discarded – undo
243 245
 	}
244 246
 
245 247
 	// assign all of the save results to the template
246
-	foreach ($saveFormResults as $k=>$v)
247
-		$template->assign($k,$v);
248
+	foreach ($saveFormResults as $k=>$v) {
249
+			$template->assign($k,$v);
250
+	}
248 251
 
249 252
 
250 253
 	// assign the resulting form
Please login to merge, or discard this patch.
neon/phoebe/controllers/database/IndexController.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,8 +52,9 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	public function actionEdit($type = null)
54 54
 	{
55
-		if (!$this->canDevelop())
56
-			throw new HttpException(403, 'This operation is not permitted here');
55
+		if (!$this->canDevelop()) {
56
+					throw new HttpException(403, 'This operation is not permitted here');
57
+		}
57 58
 
58 59
 		$form = $this->getPhoebeForm($type, $isNewForm, false, true);
59 60
 
@@ -130,8 +131,9 @@  discard block
 block discarded – undo
130 131
 			]
131 132
 		];
132 133
 		$form = new \neon\core\form\Form($formDefinition);
133
-		if (neon()->request->isAjax)
134
-			return $form->ajaxValidation();
134
+		if (neon()->request->isAjax) {
135
+					return $form->ajaxValidation();
136
+		}
135 137
 		if ($form->processRequest()) {
136 138
 			$data = $form->getData();
137 139
 			$definition = $this->canonicaliseDefinition($data);
Please login to merge, or discard this patch.
neon/phoebe/controllers/appforms/IndexController.php 1 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 1 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 1 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.
neon/phoebe/controllers/common/PhoebeValidator.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,8 +11,9 @@
 block discarded – undo
11 11
 	{
12 12
 		// get hold of the form
13 13
 		$form = neon('phoebe')->getForm($phoebeType, $classType, []);
14
-		if ($name)
15
-			$form->setName($name);
14
+		if ($name) {
15
+					$form->setName($name);
16
+		}
16 17
 		return $form->ajaxValidation();
17 18
 	}
18 19
 }
Please login to merge, or discard this patch.