Test Failed
Push — develop ( ff58ad...b8f9b2 )
by steve
13:44 queued 12s
created
neon/daedalus/services/ddsManager/DdsObjectManager.php 2 patches
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -31,14 +31,14 @@  discard block
 block discarded – undo
31 31
 	 * requests to the database within one call
32 32
 	 * @var array
33 33
 	 */
34
-	private static $_requestResultsCache=[];
35
-	private static $_linkResultsCache=[];
36
-	private static $_mapResultsCache=[];
34
+	private static $_requestResultsCache = [];
35
+	private static $_linkResultsCache = [];
36
+	private static $_mapResultsCache = [];
37 37
 
38 38
 	/**
39 39
 	 * @inheritdoc
40 40
 	 */
41
-	public function addObjectRequest($classType, array $filters=[], array $order=[], array $limit=[], $resultKey=null, $includeDeleted=false)
41
+	public function addObjectRequest($classType, array $filters = [], array $order = [], array $limit = [], $resultKey = null, $includeDeleted = false)
42 42
 	{
43 43
 		// protect ourselves against SQL injection by making sure all
44 44
 		// items are canonicalised as required (and use of PDO later)
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 					$data[$k] = self::$_requestResultsCache[$r['requestKey']];
106 106
 				} else {
107 107
 					// set null result information about the request
108
-					$newData[$k] = ['start'=>$r['limit']['start'],'length'=>0,'total'=>$r['total'],'rows'=>[]];
108
+					$newData[$k] = ['start'=>$r['limit']['start'], 'length'=>0, 'total'=>$r['total'], 'rows'=>[]];
109 109
 					$sql[] = $r['sql'];
110 110
 					if ($r['totalSql'])
111 111
 						$sql[] = $r['totalSql'];
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	/**
166 166
 	 * @inheritdoc
167 167
 	 */
168
-	public function runSingleObjectRequest($classType, array $filters=[], array $order=[], array $limit=[], $includeDeleted = false)
168
+	public function runSingleObjectRequest($classType, array $filters = [], array $order = [], array $limit = [], $includeDeleted = false)
169 169
 	{
170 170
 		if (empty($classType))
171 171
 			throw new \InvalidArgumentException('ClassType must be specified');
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	/**
190 190
 	 * @inheritdoc
191 191
 	 */
192
-	public function getObjectMap($classType, $filters=[], $fields=[], $start=0, $length=1000, $includeDeleted=false)
192
+	public function getObjectMap($classType, $filters = [], $fields = [], $start = 0, $length = 1000, $includeDeleted = false)
193 193
 	{
194 194
 		return $this->getObjectMapManager()->getObjectMap($classType, $filters, $fields, $start, $length, $includeDeleted);
195 195
 	}
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	/**
198 198
 	 * @inheritdoc
199 199
 	 */
200
-	public function makeMapLookupRequest($objectUuids, $mapFields=[], $classType=null)
200
+	public function makeMapLookupRequest($objectUuids, $mapFields = [], $classType = null)
201 201
 	{
202 202
 		return $this->getObjectMapManager()->makeMapLookupRequest($objectUuids, $mapFields, $classType);
203 203
 	}
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	/**
206 206
 	 * @inheritdoc
207 207
 	 */
208
-	public function makeMapChainLookupRequest($objectUuids, $chainMembers=[], $chainMapFields=[], $inReverse=false)
208
+	public function makeMapChainLookupRequest($objectUuids, $chainMembers = [], $chainMapFields = [], $inReverse = false)
209 209
 	{
210 210
 		return $this->getObjectMapManager()->makeMapChainLookupRequest($objectUuids, $chainMembers, $chainMapFields, $inReverse);
211 211
 	}
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	/**
249 249
 	 * @inheritdoc
250 250
 	 */
251
-	public function listObjects($classType, &$total=null, $includeDeleted=false, $inFull=true, $start=0, $length=100, $order=null)
251
+	public function listObjects($classType, &$total = null, $includeDeleted = false, $inFull = true, $start = 0, $length = 100, $order = null)
252 252
 	{
253 253
 		$classType = $this->canonicaliseRef($classType);
254 254
 		if (empty($order))
@@ -280,14 +280,14 @@  discard block
 block discarded – undo
280 280
 		if (is_array($order)) {
281 281
 			$orderBits = [];
282 282
 			foreach ($order as $k=>$d) {
283
-				if ($k[1]=='o') {
283
+				if ($k[1] == 'o') {
284 284
 					$orderBits[] = "$k $d";
285 285
 				} else if ($inFull) {
286 286
 					$orderBits[] = "[[t]].$k $d";
287 287
 				}
288 288
 			}
289 289
 			if ($orderBits)
290
-				$orderClause = implode(', ',$orderBits);
290
+				$orderClause = implode(', ', $orderBits);
291 291
 			$query->orderBy($orderClause);
292 292
 		}
293 293
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	/**
300 300
 	 * @inheritdoc
301 301
 	 */
302
-	public function addObject($classType, array $data, &$changeLogUuid=null)
302
+	public function addObject($classType, array $data, &$changeLogUuid = null)
303 303
 	{
304 304
 		$class = null;
305 305
 		$classType = $this->canonicaliseRef($classType);
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 		$object->_created = $now;
318 318
 		$object->_updated = $now;
319 319
 		if (!$object->save())
320
-			throw new \RuntimeException("Couldn't create object: ".print_r($object->errors,true));
320
+			throw new \RuntimeException("Couldn't create object: ".print_r($object->errors, true));
321 321
 
322 322
 		// increment the class's object count
323 323
 		$class->count_total += 1;
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 			$values = [];
334 334
 			foreach (array_keys($memberStorage) as $memRef) {
335 335
 				// save all non-empty fields.
336
-				if (array_key_exists($memRef, $data) && $data[$memRef]!==null && $data[$memRef]!=='') {
336
+				if (array_key_exists($memRef, $data) && $data[$memRef] !== null && $data[$memRef] !== '') {
337 337
 					$fields[] = "`$memRef`";
338 338
 					$inserts[] = ":v$count";
339 339
 					$values[":v$count"] = $data[$memRef];
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 			}
343 343
 
344 344
 			if (count($fields))
345
-				$query = "INSERT INTO `$table` (`_uuid`, ".implode(', ',$fields).") VALUES ('{$object->_uuid}', ".implode(', ', $inserts).")";
345
+				$query = "INSERT INTO `$table` (`_uuid`, ".implode(', ', $fields).") VALUES ('{$object->_uuid}', ".implode(', ', $inserts).")";
346 346
 			else
347 347
 				$query = "INSERT INTO `$table` (`_uuid`) VALUES ('{$object->_uuid}')";
348 348
 			$command = neon()->db->createCommand($query);
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 	 *
371 371
 	 * @inheritdoc
372 372
 	 */
373
-	public function addObjects($classType, array $data, $chunkSize=1000)
373
+	public function addObjects($classType, array $data, $chunkSize = 1000)
374 374
 	{
375 375
 		$classType = $this->canonicaliseRef($classType);
376 376
 		$class = null;
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 		$columns[] = '_uuid';
389 389
 		$nullRow['_uuid'] = null;
390 390
 
391
-		foreach(array_chunk($data, $chunkSize) as $chunkData) {
391
+		foreach (array_chunk($data, $chunkSize) as $chunkData) {
392 392
 			$rows = [];
393 393
 			$objectDbRows = [];
394 394
 			$objectsLinks = [];
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 			neon()->db->createCommand()->batchInsert(DdsObject::tableName(), ['_uuid', '_class_type', '_created', '_updated'], $objectDbRows)->execute();
412 412
 			neon()->db->createCommand()->batchInsert($table, $columns, $rows)->execute();
413 413
 
414
-			foreach($objectsLinks as $uuid => $links) {
414
+			foreach ($objectsLinks as $uuid => $links) {
415 415
 				// if there are any links then add these to the link table
416 416
 				//
417 417
 				// TODO - make this a bulk insert across all data
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 			$table = $this->getTableFromClassType($object->_class_type);
436 436
 			$query = "SELECT `o`.*, `t`.* FROM `dds_object` `o` LEFT JOIN  `$table` `t` ON `o`.`_uuid`=`t`.`_uuid` WHERE `o`.`_uuid`=:uuid LIMIT 1";
437 437
 			$rows = neon()->db->createCommand($query)->bindValue(':uuid', $uuid)->queryAll();
438
-			$row =  count($rows) > 0 ? $rows[0] : null;
438
+			$row = count($rows) > 0 ? $rows[0] : null;
439 439
 			$this->convertFromDBToPHP($row, $this->getMemberLinks($uuid));
440 440
 			return $row;
441 441
 		}
@@ -445,10 +445,10 @@  discard block
 block discarded – undo
445 445
 	/**
446 446
 	 * @inheritdoc
447 447
 	 */
448
-	public function editObject($uuid, array $changes, &$changeLogUuid=null)
448
+	public function editObject($uuid, array $changes, &$changeLogUuid = null)
449 449
 	{
450 450
 		// check there are some changes to make
451
-		if (count($changes)==0)
451
+		if (count($changes) == 0)
452 452
 			return false;
453 453
 
454 454
 		// check that the object exists and find its class type
@@ -493,10 +493,10 @@  discard block
 block discarded – undo
493 493
 					}
494 494
 				}
495 495
 			}
496
-			if (count($updates)==0)
496
+			if (count($updates) == 0)
497 497
 				return false;
498 498
 
499
-			$query = "UPDATE `$table` SET ".implode(', ',$updates)." WHERE `_uuid`='$uuid' LIMIT 1";
499
+			$query = "UPDATE `$table` SET ".implode(', ', $updates)." WHERE `_uuid`='$uuid' LIMIT 1";
500 500
 			neon()->db->createCommand($query)->bindValues($values)->execute();
501 501
 
502 502
 			// add or remove any links from the linking table
@@ -521,15 +521,15 @@  discard block
 block discarded – undo
521 521
 	 */
522 522
 	public function editObjects($classType, array $uuids, array $changes)
523 523
 	{
524
-		if (count($uuids)==0 || count($changes)==0)
524
+		if (count($uuids) == 0 || count($changes) == 0)
525 525
 			return false;
526 526
 		try {
527 527
 			$uuids = $this->checkUuidsAgainstClassType($uuids, $classType);
528
-			if (count($uuids)==0)
528
+			if (count($uuids) == 0)
529 529
 				return false;
530 530
 			$table = $this->getTableFromClassType($classType);
531 531
 			$memberStorage = $this->getMemberStorage($classType);
532
-			if (count($memberStorage)==0) {
532
+			if (count($memberStorage) == 0) {
533 533
 				throw new \InvalidArgumentException('Unknown or empty class type '.$classType);
534 534
 			}
535 535
 
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 					}
561 561
 				}
562 562
 			}
563
-			if (count($updates)==0)
563
+			if (count($updates) == 0)
564 564
 				return false;
565 565
 
566 566
 			// sort out the uuid clause for both the update on the table and in the object table
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 			$query = "UPDATE `dds_object` SET `_updated`=NOW() WHERE `_uuid` IN $uuidClause LIMIT ".count($uuids);
581 581
 			$db->createCommand($query)->bindValues($objectValues)->execute();
582 582
 			// make the changes
583
-			$query = "UPDATE `$table` SET ".implode(', ',$updates)." WHERE `_uuid` IN $uuidClause LIMIT ".count($uuids);
583
+			$query = "UPDATE `$table` SET ".implode(', ', $updates)." WHERE `_uuid` IN $uuidClause LIMIT ".count($uuids);
584 584
 			$db->createCommand($query)->bindValues($values)->execute();
585 585
 
586 586
 			//
@@ -604,11 +604,11 @@  discard block
 block discarded – undo
604 604
 	/**
605 605
 	 * @inheritdoc
606 606
 	 */
607
-	public function deleteObject($uuid, &$changeLogUuid=null)
607
+	public function deleteObject($uuid, &$changeLogUuid = null)
608 608
 	{
609 609
 		$object = null;
610 610
 		// find the object and delete if it hasn't already been
611
-		if ($this->getObjectFromId($uuid, $object) && $object->_deleted==0) {
611
+		if ($this->getObjectFromId($uuid, $object) && $object->_deleted == 0) {
612 612
 			$object->_deleted = 1;
613 613
 			$object->_updated = date('Y-m-d H:i:s');
614 614
 			if (!$object->save())
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 	public function deleteObjects(array $uuids)
643 643
 	{
644 644
 		$objects = $this->getObjectRowsFromIds($uuids);
645
-		if (count($objects)==0)
645
+		if (count($objects) == 0)
646 646
 			return;
647 647
 
648 648
 		$foundUuids = [];
@@ -680,11 +680,11 @@  discard block
 block discarded – undo
680 680
 	/**
681 681
 	 * @inheritdoc
682 682
 	 */
683
-	public function undeleteObject($uuid, &$changeLogUuid=null)
683
+	public function undeleteObject($uuid, &$changeLogUuid = null)
684 684
 	{
685 685
 		$object = null;
686 686
 		// find the object and delete if it hasn't already been
687
-		if ($this->getObjectFromId($uuid, $object) && $object->_deleted==1) {
687
+		if ($this->getObjectFromId($uuid, $object) && $object->_deleted == 1) {
688 688
 			$object->_deleted = 0;
689 689
 			$object->_updated = date('Y-m-d H:i:s');
690 690
 			if (!$object->save())
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 			// and update the class object deleted count
694 694
 			$class = null;
695 695
 			if ($this->findClass($object['_class_type'], $class)) {
696
-				$class->count_deleted = max(0, $class->count_deleted-1);
696
+				$class->count_deleted = max(0, $class->count_deleted - 1);
697 697
 				$class->save();
698 698
 
699 699
 				// see if we need to store the change log
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 	/**
708 708
 	 * @inheritdoc
709 709
 	 */
710
-	public function destroyObject($uuid, &$changeLogUuid=null)
710
+	public function destroyObject($uuid, &$changeLogUuid = null)
711 711
 	{
712 712
 		$object = null;
713 713
 		if ($this->getObjectFromId($uuid, $object)) {
@@ -729,9 +729,9 @@  discard block
 block discarded – undo
729 729
 
730 730
 			// then if ok, decrement the class's object counts
731 731
 			if ($class) {
732
-				$class->count_total = max(0, $class->count_total-1);
732
+				$class->count_total = max(0, $class->count_total - 1);
733 733
 				if ($object['_deleted'] == 1)
734
-					$class->count_deleted = max(0, $class->count_deleted-1);
734
+					$class->count_deleted = max(0, $class->count_deleted - 1);
735 735
 				$class->save();
736 736
 			}
737 737
 
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 	public function destroyObjects(array $uuids)
753 753
 	{
754 754
 		$objects = $this->getObjectRowsFromIds($uuids);
755
-		if (count($objects)==0)
755
+		if (count($objects) == 0)
756 756
 			return;
757 757
 
758 758
 		$objectUuids = [];
@@ -787,9 +787,9 @@  discard block
 block discarded – undo
787 787
 
788 788
 			// decrement the class's object counts
789 789
 			if ($class) {
790
-				$class->count_total = max(0, $class->count_total-count($uuids));
790
+				$class->count_total = max(0, $class->count_total - count($uuids));
791 791
 				if (isset($objectsDeleted[$classType]))
792
-					$class->count_deleted = max(0, $class->count_deleted-count($objectsDeleted[$classType]));
792
+					$class->count_deleted = max(0, $class->count_deleted - count($objectsDeleted[$classType]));
793 793
 				$class->save();
794 794
 			}
795 795
 		}
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 	 * @param [] &$dataSet  [n]=>$rows  rows of requested data
828 828
 	 * @param string $classTypeKey the key in the data that will give the class type
829 829
 	 */
830
-	private function convertResultsToPHP(&$dataSet, $links=null, $classTypeKey='_class_type')
830
+	private function convertResultsToPHP(&$dataSet, $links = null, $classTypeKey = '_class_type')
831 831
 	{
832 832
 		// if we haven't been provided any multilinks (even if empty array)
833 833
 		// then see if there are any multilinks to extract
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
 	 * @param DdsObject &$object  the returned object
851 851
 	 * @return boolean  whether or not object found
852 852
 	 */
853
-	private function getObjectFromId($uuid, &$object=null)
853
+	private function getObjectFromId($uuid, &$object = null)
854 854
 	{
855 855
 		$object = DdsObject::find()->noCache()->where(['_uuid' => $uuid])->one();
856 856
 		return ($object !== null);
@@ -899,13 +899,13 @@  discard block
 block discarded – undo
899 899
 	 * @param string $resultKey  if provided use this else create one
900 900
 	 * @return string  return the resultKey
901 901
 	 */
902
-	private function createSqlAndStoreRequest(array $request, $resultKey=null)
902
+	private function createSqlAndStoreRequest(array $request, $resultKey = null)
903 903
 	{
904 904
 		// track number of calls to function to generate unique wthin one php request per call and per request result keys
905
-		static $counter = 0; $counter ++;
905
+		static $counter = 0; $counter++;
906 906
 		// a randomly generated resultKey prevents db query chaching.
907 907
 		$resultKey = $resultKey ? $resultKey : $request['requestKey'].'_'.$counter;
908
-		$request['resultKey' ] = $resultKey;
908
+		$request['resultKey'] = $resultKey;
909 909
 		if (!array_key_exists($request['requestKey'], self::$_requestResultsCache))
910 910
 			$this->convertRequestToSql($request);
911 911
 		// store the request
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 	private function convertRequestToSql(&$request)
964 964
 	{
965 965
 		$table = $this->getTableFromClassType($request['classType']);
966
-		$links = array_keys($this->getClassMembers($request['classType'], ['link_multi','file_ref_multi']));
966
+		$links = array_keys($this->getClassMembers($request['classType'], ['link_multi', 'file_ref_multi']));
967 967
 		$where = $this->extractWhereClause($request['filters'], $request['deleted'], $links, $filterKeys);
968 968
 		$join  = $this->extractJoinClause($links, $filterKeys);
969 969
 		$order = $this->extractOrderClause($request['order']);
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 	{
1003 1003
 		$filterKeys = [];
1004 1004
 		$notDeleted = '`o`.`_deleted`=0';
1005
-		if (count($filters)==0)
1005
+		if (count($filters) == 0)
1006 1006
 			return $includeDeleted ? '' : "WHERE $notDeleted";
1007 1007
 		$this->createFilterClause($filters, $links, $filterKeys);
1008 1008
 		if (!$includeDeleted)
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
 		// Start creating the sql. $filters[0,1] will have been canonicalised, $filters[2] is protected using PDO
1088 1088
 		// Not all queries have a [2] though so should be just the operator (e.g. IS NULL)
1089 1089
 		//
1090
-		$filter = (in_array($filters[0], $links) ? "`link_{$filters[0]}`.`to_id`": $this->quoteField($filters[0]));
1090
+		$filter = (in_array($filters[0], $links) ? "`link_{$filters[0]}`.`to_id`" : $this->quoteField($filters[0]));
1091 1091
 		$filterKeys[$filters[0]] = $filters[0];
1092 1092
 		if ($this->operatorTakesObject($filters[1]) && isset($filters[2]))
1093 1093
 			$filters['itemSql'] = $filters['sql'] = "$filter ".$this->prepareForPDO($filters[1], $filters[2]);
@@ -1100,11 +1100,11 @@  discard block
 block discarded – undo
1100 1100
 	{
1101 1101
 		if (is_array($value)) {
1102 1102
 			$pdoValues = [];
1103
-			if (!in_array($operator, ['=','!=','IN','NOT IN']))
1103
+			if (!in_array($operator, ['=', '!=', 'IN', 'NOT IN']))
1104 1104
 				throw new \InvalidArgumentException("Daedalus: Cannot pass an *array* of values with an operator of $operator");
1105 1105
 			foreach ($value as $v) {
1106 1106
 				if (is_array($v))
1107
-					throw new \InvalidArgumentException("Daedalus: Cannot pass an *array* of *array* of values as filters (silly billy). You passed ".print_r($value,true));
1107
+					throw new \InvalidArgumentException("Daedalus: Cannot pass an *array* of *array* of values as filters (silly billy). You passed ".print_r($value, true));
1108 1108
 				$count = count($this->boundValues);
1109 1109
 				$variable = ":var{$count}end";
1110 1110
 				$this->boundValues[$variable] = $v;
@@ -1115,11 +1115,11 @@  discard block
 block discarded – undo
1115 1115
 				$operator = 'IN';
1116 1116
 			if ($operator == '!=')
1117 1117
 				$operator = 'NOT IN';
1118
-			return "$operator (".implode(',',$pdoValues).')';
1118
+			return "$operator (".implode(',', $pdoValues).')';
1119 1119
 		} else {
1120 1120
 			$count = count($this->boundValues);
1121 1121
 			$variable = ":var{$count}end";
1122
-			if (strpos(strtolower($operator), 'like')!==false) {
1122
+			if (strpos(strtolower($operator), 'like') !== false) {
1123 1123
 				$this->boundValues[$variable] = "%$value%";
1124 1124
 				return "$operator $variable";
1125 1125
 			} else if (strpos(strtolower($operator), 'null') !== false) {
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 	 */
1139 1139
 	private function extractOrderClause($order)
1140 1140
 	{
1141
-		if (count($order)==0)
1141
+		if (count($order) == 0)
1142 1142
 			return '';
1143 1143
 		$clause = [];
1144 1144
 		foreach ($order as $o => $d) {
@@ -1148,12 +1148,12 @@  discard block
 block discarded – undo
1148 1148
 				break;
1149 1149
 			}
1150 1150
 			// allow negative ordering in mysql for nulls last
1151
-			if (strpos($o, '-')===0)
1151
+			if (strpos($o, '-') === 0)
1152 1152
 				$clause[] = '-'.substr($o, 1)." $d";
1153 1153
 			else
1154 1154
 				$clause[] = "$o $d";
1155 1155
 		}
1156
-		return 'ORDER BY '.implode(', ',$clause);
1156
+		return 'ORDER BY '.implode(', ', $clause);
1157 1157
 	}
1158 1158
 
1159 1159
 	/**
@@ -1163,7 +1163,7 @@  discard block
 block discarded – undo
1163 1163
 	 */
1164 1164
 	private function extractLimitClause($limit)
1165 1165
 	{
1166
-		if (count($limit)==0)
1166
+		if (count($limit) == 0)
1167 1167
 			return '';
1168 1168
 		return "LIMIT $limit[start], $limit[length]";
1169 1169
 	}
@@ -1187,7 +1187,7 @@  discard block
 block discarded – undo
1187 1187
 			if (!is_array($toLinks))
1188 1188
 				$toLinks = [$toLinks];
1189 1189
 			if (!$this->areUUIDs($toLinks))
1190
-				throw new \InvalidArgumentException("The toMemberLinks should be UUID64s. You passed in ".print_r($toLinks,true));
1190
+				throw new \InvalidArgumentException("The toMemberLinks should be UUID64s. You passed in ".print_r($toLinks, true));
1191 1191
 			array_unique($toLinks);
1192 1192
 
1193 1193
 			//
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
 				$batchInsert[] = ['from_id'=>$fromLink, 'from_member'=>$member, 'to_id'=>$toLink];
1208 1208
 			$memberCount = 0;
1209 1209
 			if (count($batchInsert))
1210
-				$memberCount = neon()->db->createCommand()->batchInsert('{{%dds_link}}', ['from_id','from_member','to_id'], $batchInsert)->execute();
1210
+				$memberCount = neon()->db->createCommand()->batchInsert('{{%dds_link}}', ['from_id', 'from_member', 'to_id'], $batchInsert)->execute();
1211 1211
 			if (YII_DEBUG && $memberCount !== $batchCount)
1212 1212
 				throw new Exception("The link insertion failed for member $member - $batchCount items should have been inserted vs $memberCount actual");
1213 1213
 			$count += $memberCount;
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
 	 * @param array $changes  what the changes are
1265 1265
 	 * @return string  the uuid of the log entry
1266 1266
 	 */
1267
-	private function createChangeLogEntry($class, $changeKey, $objectUuid, $originalValues=[], $newValues=[])
1267
+	private function createChangeLogEntry($class, $changeKey, $objectUuid, $originalValues = [], $newValues = [])
1268 1268
 	{
1269 1269
 		static $changeLog = null;
1270 1270
 		if (!$changeLog)
Please login to merge, or discard this patch.
Braces   +203 added lines, -140 removed lines patch added patch discarded remove patch
@@ -115,8 +115,9 @@  discard block
 block discarded – undo
115 115
 					// set null result information about the request
116 116
 					$newData[$k] = ['start'=>$r['limit']['start'],'length'=>0,'total'=>$r['total'],'rows'=>[]];
117 117
 					$sql[] = $r['sql'];
118
-					if ($r['totalSql'])
119
-						$sql[] = $r['totalSql'];
118
+					if ($r['totalSql']) {
119
+											$sql[] = $r['totalSql'];
120
+					}
120 121
 					$resultKey2RequestKey[$r['resultKey']] = $r['requestKey'];
121 122
 				}
122 123
 			}
@@ -177,8 +178,9 @@  discard block
 block discarded – undo
177 178
 	 */
178 179
 	public function runSingleObjectRequest($classType, array $filters=[], array $order=[], array $limit=[], $includeDeleted = false)
179 180
 	{
180
-		if (empty($classType))
181
-			throw new \InvalidArgumentException('ClassType must be specified');
181
+		if (empty($classType)) {
182
+					throw new \InvalidArgumentException('ClassType must be specified');
183
+		}
182 184
 
183 185
 		// make sure that any currently queued requests from elsewhere are saved off the queue
184 186
 		$currentRequests = $this->popRequests();
@@ -253,16 +255,18 @@  discard block
 block discarded – undo
253 255
 	public function listObjects($classType, &$total=null, $includeDeleted=false, $inFull=true, $start=0, $length=100, $order=null)
254 256
 	{
255 257
 		$classType = $this->canonicaliseRef($classType);
256
-		if (empty($order))
257
-			$order = ['_created'=>'DESC'];
258
+		if (empty($order)) {
259
+					$order = ['_created'=>'DESC'];
260
+		}
258 261
 		$order = $this->canonicaliseOrder($order);
259 262
 
260 263
 		// get the total first
261 264
 		$class = null;
262 265
 		$this->findClass($classType, $class, true);
263 266
 		$total = $class->count_total;
264
-		if (!$includeDeleted)
265
-			$total -= $class->count_deleted;
267
+		if (!$includeDeleted) {
268
+					$total -= $class->count_deleted;
269
+		}
266 270
 
267 271
 		// now get the objects
268 272
 		$query = (new \neon\core\db\Query)
@@ -272,8 +276,9 @@  discard block
 block discarded – undo
272 276
 			->offset($start)
273 277
 			->limit($length);
274 278
 
275
-		if (!$includeDeleted)
276
-			$query->andWhere('[[o]].[[_deleted]] = 0');
279
+		if (!$includeDeleted) {
280
+					$query->andWhere('[[o]].[[_deleted]] = 0');
281
+		}
277 282
 		if ($inFull) {
278 283
 			$tableName = $this->getTableFromClassType($classType);
279 284
 			$query->innerJoin('{{'.$tableName.'}} t', '[[o]].[[_uuid]]=[[t]].[[_uuid]]');
@@ -288,8 +293,9 @@  discard block
 block discarded – undo
288 293
 					$orderBits[] = "[[t]].$k $d";
289 294
 				}
290 295
 			}
291
-			if ($orderBits)
292
-				$orderClause = implode(', ',$orderBits);
296
+			if ($orderBits) {
297
+							$orderClause = implode(', ',$orderBits);
298
+			}
293 299
 			$query->orderBy($orderClause);
294 300
 		}
295 301
 
@@ -306,8 +312,9 @@  discard block
 block discarded – undo
306 312
 		$class = null;
307 313
 		$classType = $this->canonicaliseRef($classType);
308 314
 		$this->findClass($classType, $class, true);
309
-		if ($class->hasChangeLog())
310
-			$newValues = $data;
315
+		if ($class->hasChangeLog()) {
316
+					$newValues = $data;
317
+		}
311 318
 		$table = $this->getTableFromClassType($classType);
312 319
 
313 320
 		// create the new object
@@ -318,8 +325,9 @@  discard block
 block discarded – undo
318 325
 		$object->_class_type = $classType;
319 326
 		$object->_created = $now;
320 327
 		$object->_updated = $now;
321
-		if (!$object->save())
322
-			throw new \RuntimeException("Couldn't create object: ".print_r($object->errors,true));
328
+		if (!$object->save()) {
329
+					throw new \RuntimeException("Couldn't create object: ".print_r($object->errors,true));
330
+		}
323 331
 
324 332
 		// increment the class's object count
325 333
 		$class->count_total += 1;
@@ -343,10 +351,11 @@  discard block
 block discarded – undo
343 351
 				}
344 352
 			}
345 353
 
346
-			if (count($fields))
347
-				$query = "INSERT INTO `$table` (`_uuid`, ".implode(', ',$fields).") VALUES ('{$object->_uuid}', ".implode(', ', $inserts).")";
348
-			else
349
-				$query = "INSERT INTO `$table` (`_uuid`) VALUES ('{$object->_uuid}')";
354
+			if (count($fields)) {
355
+							$query = "INSERT INTO `$table` (`_uuid`, ".implode(', ',$fields).") VALUES ('{$object->_uuid}', ".implode(', ', $inserts).")";
356
+			} else {
357
+							$query = "INSERT INTO `$table` (`_uuid`) VALUES ('{$object->_uuid}')";
358
+			}
350 359
 			$command = neon()->db->createCommand($query);
351 360
 			$command->bindValues($values);
352 361
 			$command->execute();
@@ -354,8 +363,9 @@  discard block
 block discarded – undo
354 363
 			// if there are any links then add these to the link table
355 364
 			$this->setMemberLinks($object->_uuid, $links);
356 365
 
357
-			if ($class->hasChangeLog())
358
-				$changeLogUuid = $this->createChangeLogEntry($class, 'ADD', $object->_uuid, [], $newValues);
366
+			if ($class->hasChangeLog()) {
367
+							$changeLogUuid = $this->createChangeLogEntry($class, 'ADD', $object->_uuid, [], $newValues);
368
+			}
359 369
 		} catch (\Exception $e) {
360 370
 			// execution failed so clean up the object
361 371
 			$object->delete();
@@ -400,8 +410,9 @@  discard block
 block discarded – undo
400 410
 			$objectsLinks = [];
401 411
 			$now = date('Y-m-d H:i:s');
402 412
 			foreach ($chunkData as $row) {
403
-				if ($class->hasChangeLog())
404
-					$newValues = $row;
413
+				if ($class->hasChangeLog()) {
414
+									$newValues = $row;
415
+				}
405 416
 				// ddt table value - format row data and append the uuid
406 417
 				$this->convertFromPHPToDB($classType, $row, $links);
407 418
 				$uuid = (!empty($row['_uuid']) && $this->isUUID($row['_uuid'])) ? $row['_uuid'] : $this->generateUUID();
@@ -411,8 +422,9 @@  discard block
 block discarded – undo
411 422
 				// object table row value
412 423
 				$objectDbRows[] = [$row['_uuid'], $classType, $now, $now];
413 424
 				$objectsLinks[$row['_uuid']] = $links;
414
-				if ($class->hasChangeLog())
415
-					$this->createChangeLogEntry($class, 'ADD', $uuid, [], $newValues);
425
+				if ($class->hasChangeLog()) {
426
+									$this->createChangeLogEntry($class, 'ADD', $uuid, [], $newValues);
427
+				}
416 428
 			}
417 429
 			neon()->db->createCommand()->batchInsert(DdsObject::tableName(), ['_uuid', '_class_type', '_created', '_updated'], $objectDbRows)->execute();
418 430
 			neon()->db->createCommand()->batchInsert($table, $columns, $rows)->execute();
@@ -454,20 +466,23 @@  discard block
 block discarded – undo
454 466
 	public function editObject($uuid, array $changes, &$changeLogUuid=null)
455 467
 	{
456 468
 		// check there are some changes to make
457
-		if (count($changes)==0)
458
-			return false;
469
+		if (count($changes)==0) {
470
+					return false;
471
+		}
459 472
 
460 473
 		// check that the object exists and find its class type
461
-		if (!$this->getObjectFromId($uuid, $object))
462
-			throw new \InvalidArgumentException("Couldn't edit object with id $uuid as not found");
474
+		if (!$this->getObjectFromId($uuid, $object)) {
475
+					throw new \InvalidArgumentException("Couldn't edit object with id $uuid as not found");
476
+		}
463 477
 
464 478
 		// see if we need to store the change log
465 479
 		$class = null;
466 480
 		$this->findClass($object['_class_type'], $class);
467 481
 
468 482
 		$object->_updated = date('Y-m-d H:i:s');
469
-		if (!$object->save())
470
-			return $object->errors;
483
+		if (!$object->save()) {
484
+					return $object->errors;
485
+		}
471 486
 
472 487
 		// now update any member changes
473 488
 		try {
@@ -499,8 +514,9 @@  discard block
 block discarded – undo
499 514
 					}
500 515
 				}
501 516
 			}
502
-			if (count($updates)==0)
503
-				return false;
517
+			if (count($updates)==0) {
518
+							return false;
519
+			}
504 520
 
505 521
 			$query = "UPDATE `$table` SET ".implode(', ',$updates)." WHERE `_uuid`='$uuid' LIMIT 1";
506 522
 			neon()->db->createCommand($query)->bindValues($values)->execute();
@@ -509,8 +525,9 @@  discard block
 block discarded – undo
509 525
 			$this->setMemberLinks($object->_uuid, $links);
510 526
 
511 527
 			// finally note the changes in the change log
512
-			if ($class && $class->hasChangeLog())
513
-				$changeLogUuid = $this->createChangeLogEntry($class, 'EDIT', $uuid, $originalValues, $newValues);
528
+			if ($class && $class->hasChangeLog()) {
529
+							$changeLogUuid = $this->createChangeLogEntry($class, 'EDIT', $uuid, $originalValues, $newValues);
530
+			}
514 531
 
515 532
 		} catch (\yii\db\exception $e) {
516 533
 			$this->clearCaches();
@@ -532,12 +549,14 @@  discard block
 block discarded – undo
532 549
 	 */
533 550
 	public function editObjects($classType, array $uuids, array $changes)
534 551
 	{
535
-		if (count($uuids)==0 || count($changes)==0)
536
-			return false;
552
+		if (count($uuids)==0 || count($changes)==0) {
553
+					return false;
554
+		}
537 555
 		try {
538 556
 			$uuids = $this->checkUuidsAgainstClassType($uuids, $classType);
539
-			if (count($uuids)==0)
540
-				return false;
557
+			if (count($uuids)==0) {
558
+							return false;
559
+			}
541 560
 			$table = $this->getTableFromClassType($classType);
542 561
 			$memberStorage = $this->getMemberStorage($classType);
543 562
 			if (count($memberStorage)==0) {
@@ -548,8 +567,9 @@  discard block
 block discarded – undo
548 567
 			$class = null;
549 568
 			$this->findClass($classType, $class);
550 569
 			if ($class && $class->hasChangeLog()) {
551
-				foreach ($uuids as $uuid)
552
-					$beforeValues[$uuid] = array_intersect_key($this->getObject($uuid), $changes);
570
+				foreach ($uuids as $uuid) {
571
+									$beforeValues[$uuid] = array_intersect_key($this->getObject($uuid), $changes);
572
+				}
553 573
 				$newValues = $changes;
554 574
 			}
555 575
 
@@ -571,8 +591,9 @@  discard block
 block discarded – undo
571 591
 					}
572 592
 				}
573 593
 			}
574
-			if (count($updates)==0)
575
-				return false;
594
+			if (count($updates)==0) {
595
+							return false;
596
+			}
576 597
 
577 598
 			// sort out the uuid clause for both the update on the table and in the object table
578 599
 			$uuidClause = [];
@@ -600,8 +621,9 @@  discard block
 block discarded – undo
600 621
 
601 622
 			// and save entries into a change log
602 623
 			if ($class && $class->hasChangeLog()) {
603
-				foreach ($beforeValues as $uuid=>$before)
604
-					$this->createChangeLogEntry($class, 'EDIT', $uuid, $before, $newValues);
624
+				foreach ($beforeValues as $uuid=>$before) {
625
+									$this->createChangeLogEntry($class, 'EDIT', $uuid, $before, $newValues);
626
+				}
605 627
 			}
606 628
 
607 629
 		} catch (\yii\db\exception $e) {
@@ -622,8 +644,9 @@  discard block
 block discarded – undo
622 644
 		if ($this->getObjectFromId($uuid, $object) && $object->_deleted==0) {
623 645
 			$object->_deleted = 1;
624 646
 			$object->_updated = date('Y-m-d H:i:s');
625
-			if (!$object->save())
626
-				throw new \RuntimeException("Couldn't delete the object: ".print_r($object->errors, true));
647
+			if (!$object->save()) {
648
+							throw new \RuntimeException("Couldn't delete the object: ".print_r($object->errors, true));
649
+			}
627 650
 			// and update the class object deleted count
628 651
 			$class = null;
629 652
 			$this->findClass($object['_class_type'], $class);
@@ -631,8 +654,9 @@  discard block
 block discarded – undo
631 654
 			$class->save();
632 655
 
633 656
 			// see if we need to store the change log
634
-			if ($class && $class->hasChangeLog())
635
-				$changeLogUuid = $this->createChangeLogEntry($class, 'DELETE', $uuid);
657
+			if ($class && $class->hasChangeLog()) {
658
+							$changeLogUuid = $this->createChangeLogEntry($class, 'DELETE', $uuid);
659
+			}
636 660
 
637 661
 			// ---- KEEP ME ----
638 662
 			// on't delete the links so any that haven't been deleted between
@@ -653,8 +677,9 @@  discard block
 block discarded – undo
653 677
 	public function deleteObjects(array $uuids)
654 678
 	{
655 679
 		$objects = $this->getObjectRowsFromIds($uuids);
656
-		if (count($objects)==0)
657
-			return;
680
+		if (count($objects)==0) {
681
+					return;
682
+		}
658 683
 
659 684
 		$foundUuids = [];
660 685
 		$foundClasses = [];
@@ -671,8 +696,9 @@  discard block
 block discarded – undo
671 696
 				$deletedUuids[$classType][$obj['_uuid']] = $obj['_uuid'];
672 697
 			}
673 698
 		}
674
-		if (count($foundUuids))
675
-			DdsObject::updateAll(['_deleted'=>1, '_updated'=>date('Y-m-d H:i:s')], ['_uuid'=>$foundUuids]);
699
+		if (count($foundUuids)) {
700
+					DdsObject::updateAll(['_deleted'=>1, '_updated'=>date('Y-m-d H:i:s')], ['_uuid'=>$foundUuids]);
701
+		}
676 702
 		foreach ($foundClasses as $type=>$count) {
677 703
 			$class = null;
678 704
 			if ($this->findClass($type, $class)) {
@@ -680,8 +706,9 @@  discard block
 block discarded – undo
680 706
 				$class->save();
681 707
 				// TODO 20200107 Make a bulk call for change log entries
682 708
 				if ($class->hasChangeLog()) {
683
-					foreach ($deletedUuids[$class->class_type] as $objUuid)
684
-						$this->createChangeLogEntry($class, 'DELETE', $objUuid);
709
+					foreach ($deletedUuids[$class->class_type] as $objUuid) {
710
+											$this->createChangeLogEntry($class, 'DELETE', $objUuid);
711
+					}
685 712
 				}
686 713
 			}
687 714
 		}
@@ -698,8 +725,9 @@  discard block
 block discarded – undo
698 725
 		if ($this->getObjectFromId($uuid, $object) && $object->_deleted==1) {
699 726
 			$object->_deleted = 0;
700 727
 			$object->_updated = date('Y-m-d H:i:s');
701
-			if (!$object->save())
702
-				throw new \RuntimeException("Couldn't undelete the object: ".print_r($object->errors, true));
728
+			if (!$object->save()) {
729
+							throw new \RuntimeException("Couldn't undelete the object: ".print_r($object->errors, true));
730
+			}
703 731
 
704 732
 			// and update the class object deleted count
705 733
 			$class = null;
@@ -708,8 +736,9 @@  discard block
 block discarded – undo
708 736
 				$class->save();
709 737
 
710 738
 				// see if we need to store the change log
711
-				if ($class->hasChangeLog())
712
-					$changeLogUuid = $this->createChangeLogEntry($class, 'UNDELETE', $uuid);
739
+				if ($class->hasChangeLog()) {
740
+									$changeLogUuid = $this->createChangeLogEntry($class, 'UNDELETE', $uuid);
741
+				}
713 742
 			}
714 743
 			$this->clearCaches();
715 744
 		}
@@ -724,8 +753,9 @@  discard block
 block discarded – undo
724 753
 		if ($this->getObjectFromId($uuid, $object)) {
725 754
 			$class = null;
726 755
 			$this->findClass($object['_class_type'], $class);
727
-			if ($class && $class->hasChangeLog())
728
-				$originalValues = $this->getObject($uuid);
756
+			if ($class && $class->hasChangeLog()) {
757
+							$originalValues = $this->getObject($uuid);
758
+			}
729 759
 
730 760
 			// delete any object table data
731 761
 			$table = $this->getTableFromClassType($object['_class_type']);
@@ -741,8 +771,9 @@  discard block
 block discarded – undo
741 771
 			// then if ok, decrement the class's object counts
742 772
 			if ($class) {
743 773
 				$class->count_total = max(0, $class->count_total-1);
744
-				if ($object['_deleted'] == 1)
745
-					$class->count_deleted = max(0, $class->count_deleted-1);
774
+				if ($object['_deleted'] == 1) {
775
+									$class->count_deleted = max(0, $class->count_deleted-1);
776
+				}
746 777
 				$class->save();
747 778
 			}
748 779
 
@@ -750,8 +781,9 @@  discard block
 block discarded – undo
750 781
 			DdsLink::deleteAll(['or', ['from_id'=>$uuid], ['to_id'=>$uuid]]);
751 782
 
752 783
 			// and note this is in the change log
753
-			if ($class && $class->hasChangeLog())
754
-				$changeLogUuid = $this->createChangeLogEntry($class, 'DESTROY', $uuid, $originalValues);
784
+			if ($class && $class->hasChangeLog()) {
785
+							$changeLogUuid = $this->createChangeLogEntry($class, 'DESTROY', $uuid, $originalValues);
786
+			}
755 787
 
756 788
 			$this->clearCaches();
757 789
 		}
@@ -763,16 +795,18 @@  discard block
 block discarded – undo
763 795
 	public function destroyObjects(array $uuids)
764 796
 	{
765 797
 		$objects = $this->getObjectRowsFromIds($uuids);
766
-		if (count($objects)==0)
767
-			return;
798
+		if (count($objects)==0) {
799
+					return;
800
+		}
768 801
 
769 802
 		$objectUuids = [];
770 803
 		$objectsDeleted = [];
771 804
 		$classUuids = [];
772 805
 		foreach ($objects as $obj) {
773 806
 			$objectUuids[$obj['_uuid']] = $obj['_uuid'];
774
-			if ($obj['_deleted'] == 1)
775
-				$objectsDeleted[$obj['_class_type']][$obj['_uuid']] = $obj['_uuid'];
807
+			if ($obj['_deleted'] == 1) {
808
+							$objectsDeleted[$obj['_class_type']][$obj['_uuid']] = $obj['_uuid'];
809
+			}
776 810
 			$classUuids[$obj['_class_type']][] = $obj['_uuid'];
777 811
 		}
778 812
 
@@ -799,8 +833,9 @@  discard block
 block discarded – undo
799 833
 			// decrement the class's object counts
800 834
 			if ($class) {
801 835
 				$class->count_total = max(0, $class->count_total-count($uuids));
802
-				if (isset($objectsDeleted[$classType]))
803
-					$class->count_deleted = max(0, $class->count_deleted-count($objectsDeleted[$classType]));
836
+				if (isset($objectsDeleted[$classType])) {
837
+									$class->count_deleted = max(0, $class->count_deleted-count($objectsDeleted[$classType]));
838
+				}
804 839
 				$class->save();
805 840
 			}
806 841
 		}
@@ -828,8 +863,9 @@  discard block
 block discarded – undo
828 863
 	 */
829 864
 	private function getObjectMapManager()
830 865
 	{
831
-		if (!$this->_objectMapManager)
832
-			$this->_objectMapManager = new DdsObjectMapManager;
866
+		if (!$this->_objectMapManager) {
867
+					$this->_objectMapManager = new DdsObjectMapManager;
868
+		}
833 869
 		return $this->_objectMapManager;
834 870
 	}
835 871
 
@@ -844,14 +880,16 @@  discard block
 block discarded – undo
844 880
 		// then see if there are any multilinks to extract
845 881
 		if ($links === null) {
846 882
 			$objectIds = [];
847
-			foreach ($dataSet as $row)
848
-				$objectIds[] = $row['_uuid'];
883
+			foreach ($dataSet as $row) {
884
+							$objectIds[] = $row['_uuid'];
885
+			}
849 886
 			$links = $this->getMembersLinks($objectIds);
850 887
 		}
851 888
 		foreach ($dataSet as &$data) {
852 889
 			// convert full rows to database. Totals are left untouched
853
-			if (isset($data[$classTypeKey]))
854
-				$this->convertFromDBToPHP($data, $links[$data['_uuid']], $classTypeKey);
890
+			if (isset($data[$classTypeKey])) {
891
+							$this->convertFromDBToPHP($data, $links[$data['_uuid']], $classTypeKey);
892
+			}
855 893
 		}
856 894
 	}
857 895
 
@@ -917,8 +955,9 @@  discard block
 block discarded – undo
917 955
 		// a randomly generated resultKey prevents db query chaching.
918 956
 		$resultKey = $resultKey ? $resultKey : $request['requestKey'].'_'.$counter;
919 957
 		$request['resultKey' ] = $resultKey;
920
-		if (!array_key_exists($request['requestKey'], self::$_requestResultsCache))
921
-			$this->convertRequestToSql($request);
958
+		if (!array_key_exists($request['requestKey'], self::$_requestResultsCache)) {
959
+					$this->convertRequestToSql($request);
960
+		}
922 961
 		// store the request
923 962
 		$this->objectRequests[$request['classType']][$resultKey] = $request;
924 963
 		return $resultKey;
@@ -995,8 +1034,9 @@  discard block
 block discarded – undo
995 1034
 	{
996 1035
 		$join = ['INNER JOIN dds_object `o` on `t`.`_uuid` = `o`.`_uuid`'];
997 1036
 		foreach ($links as $l) {
998
-			if (in_array($l, $filterKeys))
999
-				$join[] = "LEFT JOIN dds_link `link_$l` ON (`link_$l`.`from_id`=`o`.`_uuid` AND `link_$l`.`from_member`='$l')";
1037
+			if (in_array($l, $filterKeys)) {
1038
+							$join[] = "LEFT JOIN dds_link `link_$l` ON (`link_$l`.`from_id`=`o`.`_uuid` AND `link_$l`.`from_member`='$l')";
1039
+			}
1000 1040
 		}
1001 1041
 		return implode(' ', $join);
1002 1042
 	}
@@ -1013,11 +1053,13 @@  discard block
 block discarded – undo
1013 1053
 	{
1014 1054
 		$filterKeys = [];
1015 1055
 		$notDeleted = '`o`.`_deleted`=0';
1016
-		if (count($filters)==0)
1017
-			return $includeDeleted ? '' : "WHERE $notDeleted";
1056
+		if (count($filters)==0) {
1057
+					return $includeDeleted ? '' : "WHERE $notDeleted";
1058
+		}
1018 1059
 		$this->createFilterClause($filters, $links, $filterKeys);
1019
-		if (!$includeDeleted)
1020
-			return "WHERE $notDeleted AND ($filters[sql])";
1060
+		if (!$includeDeleted) {
1061
+					return "WHERE $notDeleted AND ($filters[sql])";
1062
+		}
1021 1063
 		return "WHERE $filters[sql]";
1022 1064
 	}
1023 1065
 
@@ -1036,8 +1078,9 @@  discard block
 block discarded – undo
1036 1078
 		if (is_array($filters[0])) {
1037 1079
 
1038 1080
 			foreach ($filters as $k => &$filter) {
1039
-				if ($k === 'logic')
1040
-					continue;
1081
+				if ($k === 'logic') {
1082
+									continue;
1083
+				}
1041 1084
 				$this->createFilterClause($filter, $links, $filterKeys);
1042 1085
 			}
1043 1086
 			//
@@ -1048,25 +1091,28 @@  discard block
 block discarded – undo
1048 1091
 				// in which case we combine those with to get the filterSql
1049 1092
 				$filterSql = [];
1050 1093
 				foreach ($filters as $k => &$filter) {
1051
-					if ($k === 'logic')
1052
-						continue;
1094
+					if ($k === 'logic') {
1095
+											continue;
1096
+					}
1053 1097
 					// use the logic keys if any for the items - these can be in position 3
1054 1098
 					// for most operators and position 2 for operators that don't take a key
1055 1099
 					if ($this->operatorTakesObject($filter[1])) {
1056
-						if (isset($filter[3]))
1057
-							$filterSql[$filter[3]] = $filter['itemSql'];
1058
-						else
1059
-							$filterSql[] = $filter['itemSql'];
1100
+						if (isset($filter[3])) {
1101
+													$filterSql[$filter[3]] = $filter['itemSql'];
1102
+						} else {
1103
+													$filterSql[] = $filter['itemSql'];
1104
+						}
1060 1105
 					} else {
1061
-						if (isset($filter[2]))
1062
-							$filterSql[$filter[2]] = $filter['itemSql'];
1063
-						else
1064
-							$filterSql[] = $filter['itemSql'];
1106
+						if (isset($filter[2])) {
1107
+													$filterSql[$filter[2]] = $filter['itemSql'];
1108
+						} else {
1109
+													$filterSql[] = $filter['itemSql'];
1110
+						}
1065 1111
 					}
1066 1112
 				}
1067
-				if (empty($filters['logic']))
1068
-					$filters['filterSql'] = $filters['sql'] = implode(' AND ', $filterSql);
1069
-				else {
1113
+				if (empty($filters['logic'])) {
1114
+									$filters['filterSql'] = $filters['sql'] = implode(' AND ', $filterSql);
1115
+				} else {
1070 1116
 					// make sure we test logic filters in order from longest key to shortest key
1071 1117
 					// otherwise we can end up with subkeys screwing things up
1072 1118
 					$orderedKeys = array_map('strlen', array_keys($filterSql));
@@ -1078,8 +1124,9 @@  discard block
 block discarded – undo
1078 1124
 					// double conversion,
1079 1125
 					$keys = array_keys($filterSql);
1080 1126
 					$keys2hashed = array();
1081
-					foreach ($keys as $k)
1082
-						$keys2hashed[$k] = md5($k);
1127
+					foreach ($keys as $k) {
1128
+											$keys2hashed[$k] = md5($k);
1129
+					}
1083 1130
 					$logicPass1 = str_replace($keys, $keys2hashed, $filters['logic']);
1084 1131
 					$filters['filterSql'] = $filters['sql'] = str_replace($keys2hashed, array_values($filterSql), $logicPass1);
1085 1132
 				}
@@ -1102,9 +1149,9 @@  discard block
 block discarded – undo
1102 1149
 		//
1103 1150
 		$filter = (in_array($filters[0], $links) ? "`link_{$filters[0]}`.`to_id`": $this->quoteField($filters[0]));
1104 1151
 		$filterKeys[$filters[0]] = $filters[0];
1105
-		if ($this->operatorTakesObject($filters[1]) && isset($filters[2]))
1106
-			$filters['itemSql'] = $filters['sql'] = "$filter ".$this->prepareForPDO($filters[1], $filters[2]);
1107
-		else {
1152
+		if ($this->operatorTakesObject($filters[1]) && isset($filters[2])) {
1153
+					$filters['itemSql'] = $filters['sql'] = "$filter ".$this->prepareForPDO($filters[1], $filters[2]);
1154
+		} else {
1108 1155
 			$filters['itemSql'] = $filters['sql'] = "$filter $filters[1]";
1109 1156
 		}
1110 1157
 	}
@@ -1113,21 +1160,25 @@  discard block
 block discarded – undo
1113 1160
 	{
1114 1161
 		if (is_array($value)) {
1115 1162
 			$pdoValues = [];
1116
-			if (!in_array($operator, ['=','!=','IN','NOT IN']))
1117
-				throw new \InvalidArgumentException("Daedalus: Cannot pass an *array* of values with an operator of $operator");
1163
+			if (!in_array($operator, ['=','!=','IN','NOT IN'])) {
1164
+							throw new \InvalidArgumentException("Daedalus: Cannot pass an *array* of values with an operator of $operator");
1165
+			}
1118 1166
 			foreach ($value as $v) {
1119
-				if (is_array($v))
1120
-					throw new \InvalidArgumentException("Daedalus: Cannot pass an *array* of *array* of values as filters (silly billy). You passed ".print_r($value,true));
1167
+				if (is_array($v)) {
1168
+									throw new \InvalidArgumentException("Daedalus: Cannot pass an *array* of *array* of values as filters (silly billy). You passed ".print_r($value,true));
1169
+				}
1121 1170
 				$count = count($this->boundValues);
1122 1171
 				$variable = ":var{$count}end";
1123 1172
 				$this->boundValues[$variable] = $v;
1124 1173
 				$pdoValues[] = $variable;
1125 1174
 			}
1126 1175
 			// converts equals to ins and outs
1127
-			if ($operator == '=')
1128
-				$operator = 'IN';
1129
-			if ($operator == '!=')
1130
-				$operator = 'NOT IN';
1176
+			if ($operator == '=') {
1177
+							$operator = 'IN';
1178
+			}
1179
+			if ($operator == '!=') {
1180
+							$operator = 'NOT IN';
1181
+			}
1131 1182
 			return "$operator (".implode(',',$pdoValues).')';
1132 1183
 		} else {
1133 1184
 			$count = count($this->boundValues);
@@ -1151,8 +1202,9 @@  discard block
 block discarded – undo
1151 1202
 	 */
1152 1203
 	private function extractOrderClause($order)
1153 1204
 	{
1154
-		if (count($order)==0)
1155
-			return '';
1205
+		if (count($order)==0) {
1206
+					return '';
1207
+		}
1156 1208
 		$clause = [];
1157 1209
 		foreach ($order as $o => $d) {
1158 1210
 			// if any of the order clauses are RAND then replace whole clause
@@ -1161,10 +1213,11 @@  discard block
 block discarded – undo
1161 1213
 				break;
1162 1214
 			}
1163 1215
 			// allow negative ordering in mysql for nulls last
1164
-			if (strpos($o, '-')===0)
1165
-				$clause[] = '-'.substr($o, 1)." $d";
1166
-			else
1167
-				$clause[] = "$o $d";
1216
+			if (strpos($o, '-')===0) {
1217
+							$clause[] = '-'.substr($o, 1)." $d";
1218
+			} else {
1219
+							$clause[] = "$o $d";
1220
+			}
1168 1221
 		}
1169 1222
 		return 'ORDER BY '.implode(', ',$clause);
1170 1223
 	}
@@ -1176,8 +1229,9 @@  discard block
 block discarded – undo
1176 1229
 	 */
1177 1230
 	private function extractLimitClause($limit)
1178 1231
 	{
1179
-		if (count($limit)==0)
1180
-			return '';
1232
+		if (count($limit)==0) {
1233
+					return '';
1234
+		}
1181 1235
 		return "LIMIT $limit[start], $limit[length]";
1182 1236
 	}
1183 1237
 
@@ -1193,14 +1247,17 @@  discard block
 block discarded – undo
1193 1247
 	private function setMemberLinks($fromLink, array $toMemberLinks)
1194 1248
 	{
1195 1249
 		// check you've been supplied with rinky dinky data
1196
-		if (!$this->isUUID($fromLink))
1197
-			throw new \InvalidArgumentException("The fromLink should be a UUID64. You passed in $fromLink");
1250
+		if (!$this->isUUID($fromLink)) {
1251
+					throw new \InvalidArgumentException("The fromLink should be a UUID64. You passed in $fromLink");
1252
+		}
1198 1253
 		$count = 0;
1199 1254
 		foreach ($toMemberLinks as $member => $toLinks) {
1200
-			if (!is_array($toLinks))
1201
-				$toLinks = [$toLinks];
1202
-			if (!$this->areUUIDs($toLinks))
1203
-				throw new \InvalidArgumentException("The toMemberLinks should be UUID64s. You passed in ".print_r($toLinks,true));
1255
+			if (!is_array($toLinks)) {
1256
+							$toLinks = [$toLinks];
1257
+			}
1258
+			if (!$this->areUUIDs($toLinks)) {
1259
+							throw new \InvalidArgumentException("The toMemberLinks should be UUID64s. You passed in ".print_r($toLinks,true));
1260
+			}
1204 1261
 			array_unique($toLinks);
1205 1262
 
1206 1263
 			//
@@ -1216,13 +1273,16 @@  discard block
 block discarded – undo
1216 1273
 			// add the new links in
1217 1274
 			$batchInsert = [];
1218 1275
 			$batchCount = count($toLinks);
1219
-			foreach ($toLinks as $toLink)
1220
-				$batchInsert[] = ['from_id'=>$fromLink, 'from_member'=>$member, 'to_id'=>$toLink];
1276
+			foreach ($toLinks as $toLink) {
1277
+							$batchInsert[] = ['from_id'=>$fromLink, 'from_member'=>$member, 'to_id'=>$toLink];
1278
+			}
1221 1279
 			$memberCount = 0;
1222
-			if (count($batchInsert))
1223
-				$memberCount = neon()->db->createCommand()->batchInsert('{{%dds_link}}', ['from_id','from_member','to_id'], $batchInsert)->execute();
1224
-			if (YII_DEBUG && $memberCount !== $batchCount)
1225
-				throw new Exception("The link insertion failed for member $member - $batchCount items should have been inserted vs $memberCount actual");
1280
+			if (count($batchInsert)) {
1281
+							$memberCount = neon()->db->createCommand()->batchInsert('{{%dds_link}}', ['from_id','from_member','to_id'], $batchInsert)->execute();
1282
+			}
1283
+			if (YII_DEBUG && $memberCount !== $batchCount) {
1284
+							throw new Exception("The link insertion failed for member $member - $batchCount items should have been inserted vs $memberCount actual");
1285
+			}
1226 1286
 			$count += $memberCount;
1227 1287
 		}
1228 1288
 		return $count;
@@ -1249,8 +1309,9 @@  discard block
 block discarded – undo
1249 1309
 	 */
1250 1310
 	protected function getMembersLinks(array $objectIds)
1251 1311
 	{
1252
-		if (empty($objectIds))
1253
-			return [];
1312
+		if (empty($objectIds)) {
1313
+					return [];
1314
+		}
1254 1315
 		$objectIds = array_unique($objectIds);
1255 1316
 		sort($objectIds, SORT_STRING);
1256 1317
 		$cacheKey = md5(serialize($objectIds));
@@ -1262,8 +1323,9 @@  discard block
 block discarded – undo
1262 1323
 				->asArray()
1263 1324
 				->all();
1264 1325
 			$multilinks = array_fill_keys($objectIds, []);
1265
-			foreach ($rows as $row)
1266
-				$multilinks[$row['from_id']][$row['from_member']][] = $row['to_id'];
1326
+			foreach ($rows as $row) {
1327
+							$multilinks[$row['from_id']][$row['from_member']][] = $row['to_id'];
1328
+			}
1267 1329
 			self::$_linkResultsCache[$cacheKey] = $multilinks;
1268 1330
 		}
1269 1331
 		return self::$_linkResultsCache[$cacheKey];
@@ -1280,8 +1342,9 @@  discard block
 block discarded – undo
1280 1342
 	private function createChangeLogEntry($class, $changeKey, $objectUuid, $originalValues=[], $newValues=[])
1281 1343
 	{
1282 1344
 		static $changeLog = null;
1283
-		if (!$changeLog)
1284
-			$changeLog = neon('dds')->IDdsChangeLogManagement;
1345
+		if (!$changeLog) {
1346
+					$changeLog = neon('dds')->IDdsChangeLogManagement;
1347
+		}
1285 1348
 		return $changeLog->addLogEntry($objectUuid, $class->toArray(), $changeKey, $originalValues, $newValues);
1286 1349
 	}
1287 1350
 
Please login to merge, or discard this patch.
neon/daedalus/services/ddsManager/models/DdsClass.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,9 @@
 block discarded – undo
31 31
 	 */
32 32
 	public function hasChangeLog()
33 33
 	{
34
-		if (isset($this->attributes['change_log']))
35
-			return $this->attributes['change_log'];
34
+		if (isset($this->attributes['change_log'])) {
35
+					return $this->attributes['change_log'];
36
+		}
36 37
 		return false;
37 38
 	}
38 39
 
Please login to merge, or discard this patch.
neon/daedalus/services/ddsManager/models/DdsMember.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
 	{
87 87
 		// return choices as decoded json or null
88 88
 		if (!empty($this->choices))
89
-			$this->choices = json_decode($this->choices,true);
89
+			$this->choices = json_decode($this->choices, true);
90 90
 		parent::afterFind();
91 91
 	}
92 92
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -72,10 +72,11 @@  discard block
 block discarded – undo
72 72
 	public function beforeSave($insert)
73 73
 	{
74 74
 		// choices can only be an array and are stored as JSON
75
-		if (is_array($this->choices))
76
-			$this->choices = json_encode($this->choices);
77
-		else
78
-			$this->choices = null;
75
+		if (is_array($this->choices)) {
76
+					$this->choices = json_encode($this->choices);
77
+		} else {
78
+					$this->choices = null;
79
+		}
79 80
 		return parent::beforeSave($insert);
80 81
 	}
81 82
 
@@ -85,8 +86,9 @@  discard block
 block discarded – undo
85 86
 	public function afterFind()
86 87
 	{
87 88
 		// return choices as decoded json or null
88
-		if (!empty($this->choices))
89
-			$this->choices = json_decode($this->choices,true);
89
+		if (!empty($this->choices)) {
90
+					$this->choices = json_decode($this->choices,true);
91
+		}
90 92
 		parent::afterFind();
91 93
 	}
92 94
 
Please login to merge, or discard this patch.
neon/daedalus/services/ddsManager/DdsDataDefinitionManager.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @param bool $includeDeleted
54 54
 	 * @return \yii\db\ActiveQuery
55 55
 	 */
56
-	public function countClasses($module=null, $includeDeleted=false)
56
+	public function countClasses($module = null, $includeDeleted = false)
57 57
 	{
58 58
 		$query = $this->_getClassesQuery($module, $includeDeleted);
59 59
 		return $query->count();
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	/**
63 63
 	 * @inheritdoc
64 64
 	 */
65
-	public function listClasses($module, &$total, $includeDeleted=false, $start=0, $length=100, $orderBy='label')
65
+	public function listClasses($module, &$total, $includeDeleted = false, $start = 0, $length = 100, $orderBy = 'label')
66 66
 	{
67 67
 		$query = $this->_getClassesQuery($module, $includeDeleted);
68 68
 		if ($start == 0)
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		$c->class_type = $classType;
123 123
 		$c->module = (empty($module) ? null : $module);
124 124
 		if (!$c->save())
125
-			throw new \RuntimeException("Couldn't save the class: ".print_r($c->errors,true));
125
+			throw new \RuntimeException("Couldn't save the class: ".print_r($c->errors, true));
126 126
 		$upSql = $this->getClassTypeMigrationSql($classType);
127 127
 		$downSql = "DELETE FROM `dds_class` WHERE `class_type`='$classType';";
128 128
 		$this->storeMigration($upSql, $downSql);
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	/**
134 134
 	 * @inheritdoc
135 135
 	 */
136
-	public function getClass($classType, $includeMembers=false)
136
+	public function getClass($classType, $includeMembers = false)
137 137
 	{
138 138
 		if ($this->findClass($classType, $class)) {
139 139
 			$data = $class->toArray();
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	public function editClass($classType, $changes)
151 151
 	{
152 152
 		$allowed = array_intersect_key($changes, array_flip(['label', 'description', 'module', 'change_log']));
153
-		if (count($allowed)==0)
153
+		if (count($allowed) == 0)
154 154
 			return;
155 155
 		$this->clearClassCache($classType);
156 156
 		$downSql = $this->getClassTypeMigrationSql($classType);
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	/**
235 235
 	 * @inheritdoc
236 236
 	 */
237
-	public function listMembers($classType, $includeDeleted=false, $keyBy='member_ref')
237
+	public function listMembers($classType, $includeDeleted = false, $keyBy = 'member_ref')
238 238
 	{
239 239
 		return $this->listMembersForClass($classType, $includeDeleted, $keyBy);
240 240
 	}
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	/**
243 243
 	 * @inheritdoc
244 244
 	 */
245
-	public function addMember($classType, &$memberRef, $dataTypeRef, $label, $description, $additional=null)
245
+	public function addMember($classType, &$memberRef, $dataTypeRef, $label, $description, $additional = null)
246 246
 	{
247 247
 		$classType = $this->canonicaliseRef($classType);
248 248
 		$memberRef = $this->canonicaliseRef($memberRef);
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 			// extract out any additional information
252 252
 			$choices = ((!empty($additional['choices']) && is_array($additional['choices'])) ? $additional['choices'] : []);
253 253
 			$linkClass = (!empty($additional['link_class']) ? $additional['link_class'] : null);
254
-			if (DdsMember::findOne(['class_type' => $classType, 'member_ref' => $memberRef])!==null)
254
+			if (DdsMember::findOne(['class_type' => $classType, 'member_ref' => $memberRef]) !== null)
255 255
 				throw new \InvalidArgumentException("The member $memberRef already exists");
256 256
 			if (in_array($dataTypeRef, ['link_uni', 'link_multi']) && !$linkClass) {
257 257
 				throw new \InvalidArgumentException("Link_uni, link_multi data types require a link_class to be passed for member '$classType::$memberRef'. You passed in ".print_r($additional, true));
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 			$mId = $this->storeMigration($upMember, $downMember);
276 276
 
277 277
 			// and create the member column
278
-			if (($error=$this->addClassMemberColumn($classType, $member->member_ref)) !== true) {
278
+			if (($error = $this->addClassMemberColumn($classType, $member->member_ref)) !== true) {
279 279
 				$member->delete();
280 280
 				$this->removeMigration($mId);
281 281
 				throw new \RuntimeException("Couldn't create the member column. Error=".$error);
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 	/**
289 289
 	 * @inheritdoc
290 290
 	 */
291
-	public function getMember($classType, $memberRef, $fields=[])
291
+	public function getMember($classType, $memberRef, $fields = [])
292 292
 	{
293 293
 		// !! keep member as an object so it runs all conversion code
294 294
 		$query = DdsMember::find();
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	{
311 311
 		// check that only allowed updates are made
312 312
 		$allowed = array_intersect_key($changes, array_flip(['label', 'description', 'definition', 'choices', 'link_class']));
313
-		if (count($allowed)==0)
313
+		if (count($allowed) == 0)
314 314
 			return;
315 315
 
316 316
 		// find the member and remove any illegitamate updates
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 			$downSql = $this->getTableRowReplaceSql('dds_member', $member);
333 333
 			$member->attributes = $updates;
334 334
 			if (!$member->save())
335
-				throw new \RuntimeException("Couldn't update the member: ".print_r ($member->errors, true));
335
+				throw new \RuntimeException("Couldn't update the member: ".print_r($member->errors, true));
336 336
 			$upSql = $this->getTableRowReplaceSql('dds_member', $member);
337 337
 			$this->storeMigration($upSql, $downSql);
338 338
 			$this->clearClassMemberCache($classType);
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	public function deleteMember($classType, $memberRef)
366 366
 	{
367 367
 		// delete a member if it isn't already deleted
368
-		if ($this->findMember($classType, $memberRef, $member) && $member->deleted==0) {
368
+		if ($this->findMember($classType, $memberRef, $member) && $member->deleted == 0) {
369 369
 			$upSql = "UPDATE `dds_member` SET `deleted`=1 WHERE `class_type`='$classType' AND `member_ref`='$memberRef';";
370 370
 			$downSql = "UPDATE `dds_member` SET `deleted`=0 WHERE `class_type`='$classType' AND `member_ref`='$memberRef';";
371 371
 			neon()->db->createCommand($upSql)->execute();
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 	public function undeleteMember($classType, $memberRef)
381 381
 	{
382 382
 		// undelete a member if it is already deleted
383
-		if ($this->findMember($classType, $memberRef, $member) && $member->deleted==1) {
383
+		if ($this->findMember($classType, $memberRef, $member) && $member->deleted == 1) {
384 384
 			// create migrations
385 385
 			$upSql = "UPDATE `dds_member` SET `deleted`=0 WHERE `class_type`='$classType' AND `member_ref`='$memberRef';";
386 386
 			$downSql = "UPDATE `dds_member` SET `deleted`=1 WHERE `class_type`='$classType' AND `member_ref`='$memberRef';";
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 	/**
428 428
 	 * @inheritdoc
429 429
 	 */
430
-	public function listDataTypes($includeDeleted=false)
430
+	public function listDataTypes($includeDeleted = false)
431 431
 	{
432 432
 		$query = DdsDataType::find();
433 433
 		$select = ['data_type_ref', 'label', 'description', 'definition', 'storage_ref'];
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 				$downSql = $this->getTableRowReplaceSql('dds_data_type', $dataType);
489 489
 				$dataType->attributes = $updates;
490 490
 				if (!$dataType->save())
491
-					throw new \RuntimeException("Couldn't save the datatype: ".print_r($dataType->errors(),true));
491
+					throw new \RuntimeException("Couldn't save the datatype: ".print_r($dataType->errors(), true));
492 492
 				$upSql = $this->getTableRowReplaceSql('dds_data_type', $dataType);
493 493
 				$this->storeMigration($upSql, $downSql);
494 494
 			}
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 					if (count($diff))
607 607
 						$diffs[$k] = $v;
608 608
 				} else {
609
-					if ((string)$v !== (string)$b[$k])
609
+					if ((string) $v !== (string) $b[$k])
610 610
 						$diffs[$k] = $v;
611 611
 				}
612 612
 			} else {
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 	 */
624 624
 	private static $_classCache = [];
625 625
 
626
-	private function _getClassesQuery($module=null, $includeDeleted=false)
626
+	private function _getClassesQuery($module = null, $includeDeleted = false)
627 627
 	{
628 628
 		$query = DdsClass::find();
629 629
 		$select = ['class_type', 'label', 'description', 'module', 'count_total', 'count_deleted', 'change_log'];
Please login to merge, or discard this patch.
Braces   +84 added lines, -56 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function isMemberRefUnique($classType, $candidate)
41 41
 	{
42
-		if ($this->isClassTypeUnique($classType))
43
-			throw new \InvalidArgumentException("Class type ".$this->canonicaliseRef($classType)." unknown");
42
+		if ($this->isClassTypeUnique($classType)) {
43
+					throw new \InvalidArgumentException("Class type ".$this->canonicaliseRef($classType)." unknown");
44
+		}
44 45
 		$mr = $this->canonicaliseRef($candidate);
45 46
 		$member = DdsMember::find()->where(['class_type'=>$classType, 'member_ref'=>$mr])->one();
46 47
 		return ($member == null);
@@ -65,15 +66,17 @@  discard block
 block discarded – undo
65 66
 	public function listClasses($module, &$total, $includeDeleted=false, $start=0, $length=100, $orderBy='label')
66 67
 	{
67 68
 		$query = $this->_getClassesQuery($module, $includeDeleted);
68
-		if ($start == 0)
69
-			$total = (int) $query->count();
69
+		if ($start == 0) {
70
+					$total = (int) $query->count();
71
+		}
70 72
 		$results = $query->asArray()
71 73
 			->offset($start)
72 74
 			->limit($length)
73 75
 			->orderBy($orderBy)
74 76
 			->all();
75
-		foreach ($results as &$r)
76
-			$r['count_current'] = $r['count_total'] - $r['count_deleted'];
77
+		foreach ($results as &$r) {
78
+					$r['count_current'] = $r['count_total'] - $r['count_deleted'];
79
+		}
77 80
 		return $results;
78 81
 	}
79 82
 
@@ -95,8 +98,9 @@  discard block
 block discarded – undo
95 98
 			->asArray()
96 99
 			->all();
97 100
 		$map = [];
98
-		foreach ($mappable as $m)
99
-			$map[$m['class_type']] = $m['label'];
101
+		foreach ($mappable as $m) {
102
+					$map[$m['class_type']] = $m['label'];
103
+		}
100 104
 		return $map;
101 105
 	}
102 106
 
@@ -116,13 +120,15 @@  discard block
 block discarded – undo
116 120
 	public function addClass(&$classType, $module)
117 121
 	{
118 122
 		$classType = $this->canonicaliseRef($classType);
119
-		if (DdsClass::findOne(['class_type'=>$classType]) !== null)
120
-			throw new \InvalidArgumentException("The class $classType already exists");
123
+		if (DdsClass::findOne(['class_type'=>$classType]) !== null) {
124
+					throw new \InvalidArgumentException("The class $classType already exists");
125
+		}
121 126
 		$c = new DdsClass();
122 127
 		$c->class_type = $classType;
123 128
 		$c->module = (empty($module) ? null : $module);
124
-		if (!$c->save())
125
-			throw new \RuntimeException("Couldn't save the class: ".print_r($c->errors,true));
129
+		if (!$c->save()) {
130
+					throw new \RuntimeException("Couldn't save the class: ".print_r($c->errors,true));
131
+		}
126 132
 		$upSql = $this->getClassTypeMigrationSql($classType);
127 133
 		$downSql = "DELETE FROM `dds_class` WHERE `class_type`='$classType';";
128 134
 		$this->storeMigration($upSql, $downSql);
@@ -137,8 +143,9 @@  discard block
 block discarded – undo
137 143
 	{
138 144
 		if ($this->findClass($classType, $class)) {
139 145
 			$data = $class->toArray();
140
-			if ($includeMembers)
141
-				$data['members'] = $this->listMembers($class['class_type']);
146
+			if ($includeMembers) {
147
+							$data['members'] = $this->listMembers($class['class_type']);
148
+			}
142 149
 			return $data;
143 150
 		}
144 151
 		return null;
@@ -150,8 +157,9 @@  discard block
 block discarded – undo
150 157
 	public function editClass($classType, $changes)
151 158
 	{
152 159
 		$allowed = array_intersect_key($changes, array_flip(['label', 'description', 'module', 'change_log']));
153
-		if (count($allowed)==0)
154
-			return;
160
+		if (count($allowed)==0) {
161
+					return;
162
+		}
155 163
 		$this->clearClassCache($classType);
156 164
 		$downSql = $this->getClassTypeMigrationSql($classType);
157 165
 		if ($this->findClass($classType, $class)) {
@@ -159,8 +167,9 @@  discard block
 block discarded – undo
159 167
 			$updates = array_diff_assoc($allowed, $class->attributes);
160 168
 			if (count($updates)) {
161 169
 				$class->attributes = $updates;
162
-				if (!$class->save())
163
-					throw new \RuntimeException("Dds: Couldn't update the class '$classType': ".print_r($class->errors));
170
+				if (!$class->save()) {
171
+									throw new \RuntimeException("Dds: Couldn't update the class '$classType': ".print_r($class->errors));
172
+				}
164 173
 				$upSql = $this->getClassTypeMigrationSql($classType);
165 174
 				$this->storeMigration($upSql, $downSql);
166 175
 			}
@@ -203,8 +212,9 @@  discard block
 block discarded – undo
203 212
 	public function destroyClass($classType)
204 213
 	{
205 214
 		if ($this->findClass($classType, $class)) {
206
-			if ($this->hasObjects($classType))
207
-				throw new \RunTimeException("You need to delete all objects before you can destroy a class");
215
+			if ($this->hasObjects($classType)) {
216
+							throw new \RunTimeException("You need to delete all objects before you can destroy a class");
217
+			}
208 218
 
209 219
 			// now delete the rows
210 220
 			$members = DdsMember::find()->where(['class_type'=>$class->class_type])->asArray()->all();
@@ -216,12 +226,14 @@  discard block
 block discarded – undo
216 226
 					$errors[] = $e->getMessage();
217 227
 				}
218 228
 			}
219
-			if (count($errors))
220
-				throw new \RuntimeException("Couldn't destroy all of the members: ".print_r($errors, true));
229
+			if (count($errors)) {
230
+							throw new \RuntimeException("Couldn't destroy all of the members: ".print_r($errors, true));
231
+			}
221 232
 			// now delete the class
222 233
 			// can also return 0 - which is valid - false means there has been an error
223
-			if ($class->delete() === false)
224
-				throw new \RuntimeException("Couldn't destroy the class: ".print_r($class->errors, true));
234
+			if ($class->delete() === false) {
235
+							throw new \RuntimeException("Couldn't destroy the class: ".print_r($class->errors, true));
236
+			}
225 237
 			// and clear away the table
226 238
 			$this->dropClassTable($class->class_type);
227 239
 			$this->clearClassCache($classType);
@@ -251,8 +263,9 @@  discard block
 block discarded – undo
251 263
 			// extract out any additional information
252 264
 			$choices = ((!empty($additional['choices']) && is_array($additional['choices'])) ? $additional['choices'] : []);
253 265
 			$linkClass = (!empty($additional['link_class']) ? $additional['link_class'] : null);
254
-			if (DdsMember::findOne(['class_type' => $classType, 'member_ref' => $memberRef])!==null)
255
-				throw new \InvalidArgumentException("The member $memberRef already exists");
266
+			if (DdsMember::findOne(['class_type' => $classType, 'member_ref' => $memberRef])!==null) {
267
+							throw new \InvalidArgumentException("The member $memberRef already exists");
268
+			}
256 269
 			if (in_array($dataTypeRef, ['link_uni', 'link_multi']) && !$linkClass) {
257 270
 				throw new \InvalidArgumentException("Link_uni, link_multi data types require a link_class to be passed for member '$classType::$memberRef'. You passed in ".print_r($additional, true));
258 271
 			}
@@ -265,8 +278,9 @@  discard block
 block discarded – undo
265 278
 			$member->choices = ($this->memberAllowedChoices($dataTypeRef) ? $choices : null);
266 279
 			$member->link_class = ($this->memberAllowedLinks($dataTypeRef) ? $linkClass : null);
267 280
 			$member->created = $this->now();
268
-			if (!$member->save())
269
-				throw new \RuntimeException("Couldn't save the member: ".print_r($member->errors, true));
281
+			if (!$member->save()) {
282
+							throw new \RuntimeException("Couldn't save the member: ".print_r($member->errors, true));
283
+			}
270 284
 
271 285
 			// create the migrations
272 286
 			$savedMember = $this->getMember($classType, $memberRef);
@@ -310,12 +324,14 @@  discard block
 block discarded – undo
310 324
 	{
311 325
 		// check that only allowed updates are made
312 326
 		$allowed = array_intersect_key($changes, array_flip(['label', 'description', 'definition', 'choices', 'link_class']));
313
-		if (count($allowed)==0)
314
-			return;
327
+		if (count($allowed)==0) {
328
+					return;
329
+		}
315 330
 
316 331
 		// find the member and remove any illegitamate updates
317
-		if (!$this->findMember($classType, $memberRef, $member))
318
-			throw new \InvalidArgumentException("No member found");
332
+		if (!$this->findMember($classType, $memberRef, $member)) {
333
+					throw new \InvalidArgumentException("No member found");
334
+		}
319 335
 		if (isset($allowed['choices'])) {
320 336
 			$allowed['choices'] = empty($allowed['choices']) ? [] : $allowed['choices'];
321 337
 			if (!(is_array($allowed['choices']) && $this->memberAllowedChoices($member->data_type_ref))) {
@@ -323,16 +339,18 @@  discard block
 block discarded – undo
323 339
 			}
324 340
 		}
325 341
 
326
-		if (isset($allowed['link_class']) && !$this->memberAllowedLinks($member->data_type_ref))
327
-			unset($allowed['link_class']);
342
+		if (isset($allowed['link_class']) && !$this->memberAllowedLinks($member->data_type_ref)) {
343
+					unset($allowed['link_class']);
344
+		}
328 345
 
329 346
 		// finally check to see if there are any actual updates and if so save the provided updates
330 347
 		$updates = $this->getMemberUpdateDifferences($allowed, $member->attributes);
331 348
 		if (count($updates)) {
332 349
 			$downSql = $this->getTableRowReplaceSql('dds_member', $member);
333 350
 			$member->attributes = $updates;
334
-			if (!$member->save())
335
-				throw new \RuntimeException("Couldn't update the member: ".print_r ($member->errors, true));
351
+			if (!$member->save()) {
352
+							throw new \RuntimeException("Couldn't update the member: ".print_r ($member->errors, true));
353
+			}
336 354
 			$upSql = $this->getTableRowReplaceSql('dds_member', $member);
337 355
 			$this->storeMigration($upSql, $downSql);
338 356
 			$this->clearClassMemberCache($classType);
@@ -344,13 +362,15 @@  discard block
 block discarded – undo
344 362
 	 */
345 363
 	public function setMemberAsMapField($classType, $memberRef)
346 364
 	{
347
-		if (!$this->findMember($classType, $memberRef, $member))
348
-			throw new \InvalidArgumentException("No member found");
365
+		if (!$this->findMember($classType, $memberRef, $member)) {
366
+					throw new \InvalidArgumentException("No member found");
367
+		}
349 368
 
350 369
 		// find out which member had the map field set for migrations
351 370
 		$oldMember = DdsMember::findOne(['class_type'=>$classType, 'map_field'=>1]);
352
-		if ($oldMember && $oldMember->member_ref == $memberRef)
353
-			return;
371
+		if ($oldMember && $oldMember->member_ref == $memberRef) {
372
+					return;
373
+		}
354 374
 		$upSql = "UPDATE `dds_member` SET `map_field`=(IF (`member_ref`='$memberRef', 1, 0)) WHERE `class_type`='$classType';";
355 375
 		$downSql = ($oldMember ? "UPDATE `dds_member` SET `map_field`=(IF (`member_ref`='{$oldMember->member_ref}', 1, 0)) WHERE `class_type`='$classType';" : null);
356 376
 		neon()->db->createCommand($upSql)->execute();
@@ -445,16 +465,18 @@  discard block
 block discarded – undo
445 465
 	public function addDataType(&$dataTypeRef, $label, $description, $definition, $storageRef)
446 466
 	{
447 467
 		$dataTypeRef = $this->canonicaliseRef($dataTypeRef);
448
-		if ($this->findDataType($dataTypeRef))
449
-			throw new \InvalidArgumentException("The dataType $dataTypeRef already exists");
468
+		if ($this->findDataType($dataTypeRef)) {
469
+					throw new \InvalidArgumentException("The dataType $dataTypeRef already exists");
470
+		}
450 471
 		$dt = new DdsDataType();
451 472
 		$dt->data_type_ref = $dataTypeRef;
452 473
 		$dt->label = $label;
453 474
 		$dt->description = $description;
454 475
 		$dt->definition = $definition;
455 476
 		$dt->storage_ref = $storageRef;
456
-		if (!$dt->save())
457
-			throw new \RuntimeException("Couldn't create the datatype $dataTypeRef: ".print_r($dt->errors, true));
477
+		if (!$dt->save()) {
478
+					throw new \RuntimeException("Couldn't create the datatype $dataTypeRef: ".print_r($dt->errors, true));
479
+		}
458 480
 
459 481
 		// store the migration
460 482
 		$this->findDataType($dataTypeRef, $dt);
@@ -479,16 +501,18 @@  discard block
 block discarded – undo
479 501
 	public function editDataType($dataTypeRef, $changes)
480 502
 	{
481 503
 		$allowed = array_intersect_key($changes, array_flip(['label', 'description', 'definition']));
482
-		if (count($allowed) == 0)
483
-			return;
504
+		if (count($allowed) == 0) {
505
+					return;
506
+		}
484 507
 		if ($this->findDataType($dataTypeRef, $dataType)) {
485 508
 			// make the updates if there is anything to change
486 509
 			$updates = array_diff($allowed, $dataType->attributes);
487 510
 			if (count($updates)) {
488 511
 				$downSql = $this->getTableRowReplaceSql('dds_data_type', $dataType);
489 512
 				$dataType->attributes = $updates;
490
-				if (!$dataType->save())
491
-					throw new \RuntimeException("Couldn't save the datatype: ".print_r($dataType->errors(),true));
513
+				if (!$dataType->save()) {
514
+									throw new \RuntimeException("Couldn't save the datatype: ".print_r($dataType->errors(),true));
515
+				}
492 516
 				$upSql = $this->getTableRowReplaceSql('dds_data_type', $dataType);
493 517
 				$this->storeMigration($upSql, $downSql);
494 518
 			}
@@ -552,8 +576,9 @@  discard block
 block discarded – undo
552 576
 	private function getClassTypeMigrationSql($classType)
553 577
 	{
554 578
 		$ddsClass = DdsClass::findOne(['class_type'=>$classType]);
555
-		if ($ddsClass == null)
556
-			return null;
579
+		if ($ddsClass == null) {
580
+					return null;
581
+		}
557 582
 		return $this->getTableRowReplaceSql('dds_class', $ddsClass);
558 583
 	}
559 584
 
@@ -603,11 +628,13 @@  discard block
 block discarded – undo
603 628
 				if (is_array($v)) {
604 629
 					$diff = $this->getMemberUpdateDifferences($v, $b[$k]);
605 630
 					// we want all of the array if there were any differences
606
-					if (count($diff))
607
-						$diffs[$k] = $v;
631
+					if (count($diff)) {
632
+											$diffs[$k] = $v;
633
+					}
608 634
 				} else {
609
-					if ((string)$v !== (string)$b[$k])
610
-						$diffs[$k] = $v;
635
+					if ((string)$v !== (string)$b[$k]) {
636
+											$diffs[$k] = $v;
637
+					}
611 638
 				}
612 639
 			} else {
613 640
 				$diffs[$k] = $v;
@@ -633,8 +660,9 @@  discard block
 block discarded – undo
633 660
 			$query->andWhere(['deleted' => 0]);
634 661
 		}
635 662
 		$query->select($select);
636
-		if ($module != null)
637
-			$query->andWhere(['or', ['module' => $module], ['module' => NULL]]);
663
+		if ($module != null) {
664
+					$query->andWhere(['or', ['module' => $module], ['module' => NULL]]);
665
+		}
638 666
 		return $query;
639 667
 	}
640 668
 
Please login to merge, or discard this patch.
neon/daedalus/services/ddsHelpers/DdsQueryHelpers.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 addObjectDeletionChecksOnJoin(\yii\db\Query $query, $tables, $join='innerJoin')
21
+	public function addObjectDeletionChecksOnJoin(\yii\db\Query $query, $tables, $join = 'innerJoin')
22 22
 	{
23 23
 		foreach ($tables as $table) {
24 24
 			if ($join == 'innerJoin') {
Please login to merge, or discard this patch.
neon/daedalus/plugins/smarty/function.getDdsObject.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@
 block discarded – undo
13 13
  */
14 14
 function smarty_function_getDdsObject($params, $template)
15 15
 {
16
-	if (!isset($params['uuid']))
17
-		throw new InvalidArgumentException("DdsObjectToJson - you need to pass in the 'uuid'");
16
+	if (!isset($params['uuid'])) {
17
+			throw new InvalidArgumentException("DdsObjectToJson - you need to pass in the 'uuid'");
18
+	}
18 19
 	$assign = !empty($params['assign']) ? $params['assign'] : 'ddsObject';
19 20
 	$asJson = isset($params['asJson']) ? $params['asJson'] : false;
20 21
 	$dds = neon('dds')->IDdsObjectManagement;
Please login to merge, or discard this patch.
neon/daedalus/controllers/IndexController.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -244,7 +244,7 @@
 block discarded – undo
244 244
 			if ($count)
245 245
 				$classes = array_merge($classes, $nextSet);
246 246
 			$start += $count;
247
-		} while ($count>0);
247
+		} while ($count > 0);
248 248
 		$classesByType = array_column($classes, null, 'class_type');
249 249
 
250 250
 		// get the full definition of these
Please login to merge, or discard this patch.
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -103,8 +103,9 @@  discard block
 block discarded – undo
103 103
 		$form = $this->getPhoebeForm($type);
104 104
 		$object = $this->ddo()->getObject($id);
105 105
 		$form->loadFromDb($object);
106
-		if (neon()->request->getIsAjax())
107
-			return $form->ajaxValidation();
106
+		if (neon()->request->getIsAjax()) {
107
+					return $form->ajaxValidation();
108
+		}
108 109
 
109 110
 		if ($form->processRequest()) {
110 111
 			$this->ddo()->editObject($id, $form->getData());
@@ -128,8 +129,9 @@  discard block
 block discarded – undo
128 129
 	public function actionDeleteObject($type, $id, $redirect = true)
129 130
 	{
130 131
 		$this->ddo()->deleteObject($id);
131
-		if ($redirect)
132
-			$this->redirect(['/daedalus/index/list', 'type' => $type]);
132
+		if ($redirect) {
133
+					$this->redirect(['/daedalus/index/list', 'type' => $type]);
134
+		}
133 135
 	}
134 136
 
135 137
 	/**
@@ -141,8 +143,9 @@  discard block
 block discarded – undo
141 143
 	public function actionUndeleteObject($type, $id, $redirect = true)
142 144
 	{
143 145
 		$this->ddo()->undeleteObject($id);
144
-		if ($redirect)
145
-			$this->redirect(['/daedalus/index/list', 'type' => $type]);
146
+		if ($redirect) {
147
+					$this->redirect(['/daedalus/index/list', 'type' => $type]);
148
+		}
146 149
 	}
147 150
 
148 151
 	/**
@@ -154,8 +157,9 @@  discard block
 block discarded – undo
154 157
 	public function actionDestroyObject($type, $id, $redirect = true)
155 158
 	{
156 159
 		$this->ddo()->destroyObject($id);
157
-		if ($redirect)
158
-			$this->redirect(['/daedalus/index/list', 'type' => $type]);
160
+		if ($redirect) {
161
+					$this->redirect(['/daedalus/index/list', 'type' => $type]);
162
+		}
159 163
 	}
160 164
 
161 165
 
@@ -170,8 +174,9 @@  discard block
 block discarded – undo
170 174
 		while ($rows > 0) {
171 175
 			$count = min($rows, 100);
172 176
 			$data = [];
173
-			for ($i = 0; $i < $count; $i++)
174
-				$data[] = $form->fake();
177
+			for ($i = 0; $i < $count; $i++) {
178
+							$data[] = $form->fake();
179
+			}
175 180
 			$this->ddo()->addObjects($type, $data);
176 181
 			$rows -= $count;
177 182
 		}
@@ -281,8 +286,9 @@  discard block
 block discarded – undo
281 286
 		do {
282 287
 			$nextSet = $ddc->listClasses(null, $total, false, $start, $length);
283 288
 			$count = count($nextSet);
284
-			if ($count)
285
-				$classes = array_merge($classes, $nextSet);
289
+			if ($count) {
290
+							$classes = array_merge($classes, $nextSet);
291
+			}
286 292
 			$start += $count;
287 293
 		} while ($count>0);
288 294
 		$classesByType = array_column($classes, null, 'class_type');
@@ -295,8 +301,9 @@  discard block
 block discarded – undo
295 301
 			foreach ($class['members'] as &$member) {
296 302
 				$member['data_type'] = $dataTypeByRef[$member['data_type_ref']];
297 303
 				$member['links_to_table'] = null;
298
-				if ($member['link_class'] && isset($classesByType[$member['link_class']]))
299
-					$member['links_to_table'] = $classesByType[$member['link_class']]['label'];
304
+				if ($member['link_class'] && isset($classesByType[$member['link_class']])) {
305
+									$member['links_to_table'] = $classesByType[$member['link_class']]['label'];
306
+				}
300 307
 			}
301 308
 			$definitions[$c['class_type']] = $class;
302 309
 		}
Please login to merge, or discard this patch.
neon/daedalus/controllers/common/DaedalusController.php 2 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -82,8 +82,9 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	protected function ddo()
84 84
 	{
85
-		if ($this->_ddo == null)
86
-			$this->_ddo = neon('dds')->IDdsObjectManagement;
85
+		if ($this->_ddo == null) {
86
+					$this->_ddo = neon('dds')->IDdsObjectManagement;
87
+		}
87 88
 		return $this->_ddo;
88 89
 	}
89 90
 
@@ -92,8 +93,9 @@  discard block
 block discarded – undo
92 93
 	 */
93 94
 	protected function ddc()
94 95
 	{
95
-		if ($this->_ddc == null)
96
-			$this->_ddc = neon('dds')->IDdsClassManagement;
96
+		if ($this->_ddc == null) {
97
+					$this->_ddc = neon('dds')->IDdsClassManagement;
98
+		}
97 99
 		return $this->_ddc;
98 100
 	}
99 101
 
@@ -102,8 +104,9 @@  discard block
 block discarded – undo
102 104
 	 */
103 105
 	protected function ddt()
104 106
 	{
105
-		if ($this->_ddt == null)
106
-			$this->_ddt = neon('dds')->IDdsDataTypeManagement;
107
+		if ($this->_ddt == null) {
108
+					$this->_ddt = neon('dds')->IDdsDataTypeManagement;
109
+		}
107 110
 		return $this->_ddt;
108 111
 	}
109 112
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 	 * @param array $options additional options for the form
40 40
 	 * @return \neon\core\form\Form
41 41
 	 */
42
-	protected function getPhoebeForm($type, $options=[])
42
+	protected function getPhoebeForm($type, $options = [])
43 43
 	{
44 44
 		return neon()->phoebe->getForm('daedalus', $type, $options);
45 45
 	}
Please login to merge, or discard this patch.
neon/daedalus/controllers/api/ClassController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
 		} catch (\Exception $e) {
66 66
 			// error occured lets see if it's because the class does not exist
67 67
 			if (neon()->getDds()->IDdsClassManagement->getClass($class) === null) {
68
-				throw new HttpException(404, 'No class exists with name ' . $class);
68
+				throw new HttpException(404, 'No class exists with name '.$class);
69 69
 			}
70 70
 			throw new HttpException(500, $e->getMessage());
71 71
 		}
Please login to merge, or discard this patch.