Passed
Push — develop ( 44d21a...7d51f9 )
by Neill
34:25 queued 18:25
created
neon/daedalus/services/ddsManager/DdsObjectManager.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 			$query->andWhere('[[o]].[[_deleted]] = 0');
277 277
 		if ($inFull) {
278 278
 			$tableName = $this->getTableFromClassType($classType);
279
-			$query->innerJoin('{{' . $tableName . '}} t', '[[o]].[[_uuid]]=[[t]].[[_uuid]]');
279
+			$query->innerJoin('{{'.$tableName.'}} t', '[[o]].[[_uuid]]=[[t]].[[_uuid]]');
280 280
 		}
281 281
 
282 282
 		if (is_array($order)) {
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 		$object->_created = $now;
320 320
 		$object->_updated = $now;
321 321
 		if (!$object->save())
322
-			throw new \RuntimeException("Couldn't create object: " . print_r($object->errors, true));
322
+			throw new \RuntimeException("Couldn't create object: ".print_r($object->errors, true));
323 323
 
324 324
 		// increment the class's object count
325 325
 		$class->count_total += 1;
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 			}
345 345
 
346 346
 			if (count($fields))
347
-				$query = "INSERT INTO `$table` (`_uuid`, " . implode(', ', $fields) . ") VALUES ('{$object->_uuid}', " . implode(', ', $inserts) . ")";
347
+				$query = "INSERT INTO `$table` (`_uuid`, ".implode(', ', $fields).") VALUES ('{$object->_uuid}', ".implode(', ', $inserts).")";
348 348
 			else
349 349
 				$query = "INSERT INTO `$table` (`_uuid`) VALUES ('{$object->_uuid}')";
350 350
 			$command = neon()->db->createCommand($query);
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 			$table = $this->getTableFromClassType($object->_class_type);
433 433
 			$query = "SELECT `o`.*, `t`.* FROM `dds_object` `o` LEFT JOIN  `$table` `t` ON `o`.`_uuid`=`t`.`_uuid` WHERE `o`.`_uuid`=:uuid LIMIT 1";
434 434
 			$rows = neon()->db->createCommand($query)->bindValue(':uuid', $uuid)->queryAll();
435
-			$row =  count($rows) > 0 ? $rows[0] : null;
435
+			$row = count($rows) > 0 ? $rows[0] : null;
436 436
 			$this->convertFromDBToPHP($row, $this->getMemberLinks($uuid));
437 437
 			return $row;
438 438
 		}
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 			if (count($updates) == 0)
491 491
 				return false;
492 492
 
493
-			$query = "UPDATE `$table` SET " . implode(', ', $updates) . " WHERE `_uuid`='$uuid' LIMIT 1";
493
+			$query = "UPDATE `$table` SET ".implode(', ', $updates)." WHERE `_uuid`='$uuid' LIMIT 1";
494 494
 			neon()->db->createCommand($query)->bindValues($values)->execute();
495 495
 
496 496
 			// add or remove any links from the linking table
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 			$table = $this->getTableFromClassType($classType);
530 530
 			$memberStorage = $this->getMemberStorage($classType);
531 531
 			if (count($memberStorage) == 0) {
532
-				throw new \InvalidArgumentException('Unknown or empty class type ' . $classType);
532
+				throw new \InvalidArgumentException('Unknown or empty class type '.$classType);
533 533
 			}
534 534
 
535 535
 			// see if we are recording changes into the change log
@@ -572,14 +572,14 @@  discard block
 block discarded – undo
572 572
 				$objectValues[$placeHolder] = $id;
573 573
 				$count++;
574 574
 			}
575
-			$uuidClause = '(' . implode(',', $uuidClause) . ')';
575
+			$uuidClause = '('.implode(',', $uuidClause).')';
576 576
 
577 577
 			// update the latest changed
578 578
 			$db = neon()->db;
579
-			$query = "UPDATE `dds_object` SET `_updated`=NOW() WHERE `_uuid` IN $uuidClause LIMIT " . count($uuids);
579
+			$query = "UPDATE `dds_object` SET `_updated`=NOW() WHERE `_uuid` IN $uuidClause LIMIT ".count($uuids);
580 580
 			$db->createCommand($query)->bindValues($objectValues)->execute();
581 581
 			// make the changes
582
-			$query = "UPDATE `$table` SET " . implode(', ', $updates) . " WHERE `_uuid` IN $uuidClause LIMIT " . count($uuids);
582
+			$query = "UPDATE `$table` SET ".implode(', ', $updates)." WHERE `_uuid` IN $uuidClause LIMIT ".count($uuids);
583 583
 			$db->createCommand($query)->bindValues($values)->execute();
584 584
 
585 585
 			//
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
 			$object->_deleted = 1;
611 611
 			$object->_updated = date('Y-m-d H:i:s');
612 612
 			if (!$object->save())
613
-				throw new \RuntimeException("Couldn't delete the object: " . print_r($object->errors, true));
613
+				throw new \RuntimeException("Couldn't delete the object: ".print_r($object->errors, true));
614 614
 			// and update the class object deleted count
615 615
 			$class = null;
616 616
 			$this->findClass($object['_class_type'], $class);
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 			$object->_deleted = 0;
699 699
 			$object->_updated = date('Y-m-d H:i:s');
700 700
 			if (!$object->save())
701
-				throw new \RuntimeException("Couldn't undelete the object: " . print_r($object->errors, true));
701
+				throw new \RuntimeException("Couldn't undelete the object: ".print_r($object->errors, true));
702 702
 
703 703
 			// and update the class object deleted count
704 704
 			$class = null;
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
 		static $counter = 0;
916 916
 		$counter++;
917 917
 		// a randomly generated resultKey prevents db query chaching.
918
-		$resultKey = $resultKey ? $resultKey : $request['requestKey'] . '_' . $counter;
918
+		$resultKey = $resultKey ? $resultKey : $request['requestKey'].'_'.$counter;
919 919
 		$request['resultKey'] = $resultKey;
920 920
 		if (!array_key_exists($request['requestKey'], self::$_requestResultsCache))
921 921
 			$this->convertRequestToSql($request);
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 					$clauseSql[] = $filter['filterSql'];
1092 1092
 					unset($filter['sql']);
1093 1093
 				}
1094
-				$filters['sql'] = '(' . implode(') OR (', $clauseSql) . ')';
1094
+				$filters['sql'] = '('.implode(') OR (', $clauseSql).')';
1095 1095
 			}
1096 1096
 			return;
1097 1097
 		}
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
 		$filter = (in_array($filters[0], $links) ? "`link_{$filters[0]}`.`to_id`" : $this->quoteField($filters[0]));
1104 1104
 		$filterKeys[$filters[0]] = $filters[0];
1105 1105
 		if ($this->operatorTakesObject($filters[1]) && isset($filters[2]))
1106
-			$filters['itemSql'] = $filters['sql'] = "$filter " . $this->prepareForPDO($filters[1], $filters[2]);
1106
+			$filters['itemSql'] = $filters['sql'] = "$filter ".$this->prepareForPDO($filters[1], $filters[2]);
1107 1107
 		else {
1108 1108
 			$filters['itemSql'] = $filters['sql'] = "$filter $filters[1]";
1109 1109
 		}
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
 				throw new \InvalidArgumentException("Daedalus: Cannot pass an *array* of values with an operator of $operator");
1118 1118
 			foreach ($value as $v) {
1119 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));
1120
+					throw new \InvalidArgumentException("Daedalus: Cannot pass an *array* of *array* of values as filters (silly billy). You passed ".print_r($value, true));
1121 1121
 				$count = count($this->boundValues);
1122 1122
 				$variable = ":var{$count}end";
1123 1123
 				$this->boundValues[$variable] = $v;
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
 				$operator = 'IN';
1129 1129
 			if ($operator == '!=')
1130 1130
 				$operator = 'NOT IN';
1131
-			return "$operator (" . implode(',', $pdoValues) . ')';
1131
+			return "$operator (".implode(',', $pdoValues).')';
1132 1132
 		} else {
1133 1133
 			$count = count($this->boundValues);
1134 1134
 			$variable = ":var{$count}end";
@@ -1162,11 +1162,11 @@  discard block
 block discarded – undo
1162 1162
 			}
1163 1163
 			// allow negative ordering in mysql for nulls last
1164 1164
 			if (strpos($o, '-') === 0)
1165
-				$clause[] = '-' . substr($o, 1) . " $d";
1165
+				$clause[] = '-'.substr($o, 1)." $d";
1166 1166
 			else
1167 1167
 				$clause[] = "$o $d";
1168 1168
 		}
1169
-		return 'ORDER BY ' . implode(', ', $clause);
1169
+		return 'ORDER BY '.implode(', ', $clause);
1170 1170
 	}
1171 1171
 
1172 1172
 	/**
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
 					if (!is_array($toLinks))
1206 1206
 						$toLinks = [$toLinks];
1207 1207
 					if (!$this->areUUIDs($toLinks))
1208
-						throw new \InvalidArgumentException("The toMemberLinks should be UUID64s. You passed in " . print_r($toLinks, true));
1208
+						throw new \InvalidArgumentException("The toMemberLinks should be UUID64s. You passed in ".print_r($toLinks, true));
1209 1209
 					$toLinks = array_unique($toLinks);
1210 1210
 
1211 1211
 					//
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 			$objectValues[$placeHolder] = $id;
1331 1331
 			$count++;
1332 1332
 		}
1333
-		$uuidClause = '(' . implode(',', $uuidClause) . ')';
1333
+		$uuidClause = '('.implode(',', $uuidClause).')';
1334 1334
 		$query = "SELECT [[_uuid]] FROM [[dds_object]] WHERE [[_class_type]]='$classType' AND [[_uuid]] IN $uuidClause";
1335 1335
 		$checkedUuidResults = $db->createCommand($query)->bindValues($objectValues)->queryAll();
1336 1336
 		return array_column($checkedUuidResults, '_uuid');
Please login to merge, or discard this patch.
Braces   +206 added lines, -142 removed lines patch added patch discarded remove patch
@@ -107,8 +107,9 @@  discard block
 block discarded – undo
107 107
 					// set null result information about the request
108 108
 					$newData[$k] = ['start' => $r['limit']['start'], 'length' => 0, 'total' => $r['total'], 'rows' => []];
109 109
 					$sql[] = $r['sql'];
110
-					if ($r['totalSql'])
111
-						$sql[] = $r['totalSql'];
110
+					if ($r['totalSql']) {
111
+											$sql[] = $r['totalSql'];
112
+					}
112 113
 					$resultKey2RequestKey[$r['resultKey']] = $r['requestKey'];
113 114
 				}
114 115
 			}
@@ -169,8 +170,9 @@  discard block
 block discarded – undo
169 170
 	 */
170 171
 	public function runSingleObjectRequest($classType, array $filters = [], array $order = [], array $limit = [], $includeDeleted = false)
171 172
 	{
172
-		if (empty($classType))
173
-			throw new \InvalidArgumentException('ClassType must be specified');
173
+		if (empty($classType)) {
174
+					throw new \InvalidArgumentException('ClassType must be specified');
175
+		}
174 176
 
175 177
 		// make sure that any currently queued requests from elsewhere are saved off the queue
176 178
 		$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();
@@ -399,8 +409,9 @@  discard block
 block discarded – undo
399 409
 			$objectsLinks = [];
400 410
 			$now = date('Y-m-d H:i:s');
401 411
 			foreach ($chunkData as $row) {
402
-				if ($hasChangeLog)
403
-					$newValues = $row;
412
+				if ($hasChangeLog) {
413
+									$newValues = $row;
414
+				}
404 415
 				// ddt table value - format row data and append the uuid
405 416
 				$this->convertFromPHPToDB($classType, $row, $links);
406 417
 				$uuid = (!empty($row['_uuid']) && $this->isUUID($row['_uuid'])) ? $row['_uuid'] : $this->generateUUID();
@@ -410,8 +421,9 @@  discard block
 block discarded – undo
410 421
 				// object table row value
411 422
 				$objectDbRows[] = [$row['_uuid'], $classType, $now, $now];
412 423
 				$objectsLinks[$row['_uuid']] = $links;
413
-				if ($hasChangeLog)
414
-					$this->createChangeLogEntry($class, 'ADD', $uuid, [], $newValues);
424
+				if ($hasChangeLog) {
425
+									$this->createChangeLogEntry($class, 'ADD', $uuid, [], $newValues);
426
+				}
415 427
 			}
416 428
 			neon()->db->createCommand()->batchInsert(DdsObject::tableName(), ['_uuid', '_class_type', '_created', '_updated'], $objectDbRows)->execute();
417 429
 			neon()->db->createCommand()->batchInsert($table, $columns, $rows)->execute();
@@ -445,20 +457,23 @@  discard block
 block discarded – undo
445 457
 	public function editObject($uuid, array $changes, &$changeLogUuid = null)
446 458
 	{
447 459
 		// check there are some changes to make
448
-		if (count($changes) == 0)
449
-			return false;
460
+		if (count($changes) == 0) {
461
+					return false;
462
+		}
450 463
 
451 464
 		// check that the object exists and find its class type
452
-		if (!$this->getObjectFromId($uuid, $object))
453
-			throw new \InvalidArgumentException("Couldn't edit object with id $uuid as not found");
465
+		if (!$this->getObjectFromId($uuid, $object)) {
466
+					throw new \InvalidArgumentException("Couldn't edit object with id $uuid as not found");
467
+		}
454 468
 
455 469
 		// see if we need to store the change log
456 470
 		$class = null;
457 471
 		$this->findClass($object['_class_type'], $class);
458 472
 
459 473
 		$object->_updated = date('Y-m-d H:i:s');
460
-		if (!$object->save())
461
-			return $object->errors;
474
+		if (!$object->save()) {
475
+					return $object->errors;
476
+		}
462 477
 
463 478
 		// now update any member changes
464 479
 		try {
@@ -487,8 +502,9 @@  discard block
 block discarded – undo
487 502
 					}
488 503
 				}
489 504
 			}
490
-			if (count($updates) == 0)
491
-				return false;
505
+			if (count($updates) == 0) {
506
+							return false;
507
+			}
492 508
 
493 509
 			$query = "UPDATE `$table` SET " . implode(', ', $updates) . " WHERE `_uuid`='$uuid' LIMIT 1";
494 510
 			neon()->db->createCommand($query)->bindValues($values)->execute();
@@ -497,8 +513,9 @@  discard block
 block discarded – undo
497 513
 			$this->setMemberLinks($object->_uuid, $links);
498 514
 
499 515
 			// finally note the changes in the change log
500
-			if ($class && $class->hasChangeLog())
501
-				$changeLogUuid = $this->createChangeLogEntry($class, 'EDIT', $uuid, $originalValues, $newValues);
516
+			if ($class && $class->hasChangeLog()) {
517
+							$changeLogUuid = $this->createChangeLogEntry($class, 'EDIT', $uuid, $originalValues, $newValues);
518
+			}
502 519
 		} catch (\yii\db\exception $e) {
503 520
 			$this->clearCaches();
504 521
 			return ['error' => $e->getMessage()];
@@ -520,12 +537,14 @@  discard block
 block discarded – undo
520 537
 	 */
521 538
 	public function editObjects($classType, array $uuids, array $changes)
522 539
 	{
523
-		if (count($uuids) == 0 || count($changes) == 0)
524
-			return false;
540
+		if (count($uuids) == 0 || count($changes) == 0) {
541
+					return false;
542
+		}
525 543
 		try {
526 544
 			$uuids = $this->checkUuidsAgainstClassType($uuids, $classType);
527
-			if (count($uuids) == 0)
528
-				return false;
545
+			if (count($uuids) == 0) {
546
+							return false;
547
+			}
529 548
 			$table = $this->getTableFromClassType($classType);
530 549
 			$memberStorage = $this->getMemberStorage($classType);
531 550
 			if (count($memberStorage) == 0) {
@@ -536,8 +555,9 @@  discard block
 block discarded – undo
536 555
 			$class = null;
537 556
 			$this->findClass($classType, $class);
538 557
 			if ($class && $class->hasChangeLog()) {
539
-				foreach ($uuids as $uuid)
540
-					$beforeValues[$uuid] = array_intersect_key($this->getObject($uuid), $changes);
558
+				foreach ($uuids as $uuid) {
559
+									$beforeValues[$uuid] = array_intersect_key($this->getObject($uuid), $changes);
560
+				}
541 561
 				$newValues = $changes;
542 562
 			}
543 563
 
@@ -559,8 +579,9 @@  discard block
 block discarded – undo
559 579
 					}
560 580
 				}
561 581
 			}
562
-			if (count($updates) == 0)
563
-				return false;
582
+			if (count($updates) == 0) {
583
+							return false;
584
+			}
564 585
 
565 586
 			// sort out the uuid clause for both the update on the table and in the object table
566 587
 			$uuidClause = [];
@@ -588,8 +609,9 @@  discard block
 block discarded – undo
588 609
 
589 610
 			// and save entries into a change log
590 611
 			if ($class && $class->hasChangeLog()) {
591
-				foreach ($beforeValues as $uuid => $before)
592
-					$this->createChangeLogEntry($class, 'EDIT', $uuid, $before, $newValues);
612
+				foreach ($beforeValues as $uuid => $before) {
613
+									$this->createChangeLogEntry($class, 'EDIT', $uuid, $before, $newValues);
614
+				}
593 615
 			}
594 616
 		} catch (\yii\db\exception $e) {
595 617
 			$this->clearCaches();
@@ -609,8 +631,9 @@  discard block
 block discarded – undo
609 631
 		if ($this->getObjectFromId($uuid, $object) && $object->_deleted == 0) {
610 632
 			$object->_deleted = 1;
611 633
 			$object->_updated = date('Y-m-d H:i:s');
612
-			if (!$object->save())
613
-				throw new \RuntimeException("Couldn't delete the object: " . print_r($object->errors, true));
634
+			if (!$object->save()) {
635
+							throw new \RuntimeException("Couldn't delete the object: " . print_r($object->errors, true));
636
+			}
614 637
 			// and update the class object deleted count
615 638
 			$class = null;
616 639
 			$this->findClass($object['_class_type'], $class);
@@ -618,8 +641,9 @@  discard block
 block discarded – undo
618 641
 			$class->save();
619 642
 
620 643
 			// see if we need to store the change log
621
-			if ($class && $class->hasChangeLog())
622
-				$changeLogUuid = $this->createChangeLogEntry($class, 'DELETE', $uuid);
644
+			if ($class && $class->hasChangeLog()) {
645
+							$changeLogUuid = $this->createChangeLogEntry($class, 'DELETE', $uuid);
646
+			}
623 647
 
624 648
 			/** ---- KEEP ME ----
625 649
 			 * don't delete the links so any that haven't been deleted between
@@ -642,8 +666,9 @@  discard block
 block discarded – undo
642 666
 	public function deleteObjects(array $uuids)
643 667
 	{
644 668
 		$objects = $this->getObjectRowsFromIds($uuids);
645
-		if (count($objects) == 0)
646
-			return;
669
+		if (count($objects) == 0) {
670
+					return;
671
+		}
647 672
 
648 673
 		$foundUuids = [];
649 674
 		$foundClasses = [];
@@ -660,8 +685,9 @@  discard block
 block discarded – undo
660 685
 				$deletedUuids[$classType][$obj['_uuid']] = $obj['_uuid'];
661 686
 			}
662 687
 		}
663
-		if (count($foundUuids))
664
-			DdsObject::updateAll(['_deleted' => 1, '_updated' => date('Y-m-d H:i:s')], ['_uuid' => $foundUuids]);
688
+		if (count($foundUuids)) {
689
+					DdsObject::updateAll(['_deleted' => 1, '_updated' => date('Y-m-d H:i:s')], ['_uuid' => $foundUuids]);
690
+		}
665 691
 		foreach ($foundClasses as $type => $count) {
666 692
 			$class = null;
667 693
 			if ($this->findClass($type, $class)) {
@@ -669,8 +695,9 @@  discard block
 block discarded – undo
669 695
 				$class->save();
670 696
 				// TODO 20200107 Make a bulk call for change log entries
671 697
 				if ($class->hasChangeLog()) {
672
-					foreach ($deletedUuids[$class->class_type] as $objUuid)
673
-						$this->createChangeLogEntry($class, 'DELETE', $objUuid);
698
+					foreach ($deletedUuids[$class->class_type] as $objUuid) {
699
+											$this->createChangeLogEntry($class, 'DELETE', $objUuid);
700
+					}
674 701
 				}
675 702
 			}
676 703
 		}
@@ -697,8 +724,9 @@  discard block
 block discarded – undo
697 724
 		if ($this->getObjectFromId($uuid, $object) && $object->_deleted == 1) {
698 725
 			$object->_deleted = 0;
699 726
 			$object->_updated = date('Y-m-d H:i:s');
700
-			if (!$object->save())
701
-				throw new \RuntimeException("Couldn't undelete the object: " . print_r($object->errors, true));
727
+			if (!$object->save()) {
728
+							throw new \RuntimeException("Couldn't undelete the object: " . print_r($object->errors, true));
729
+			}
702 730
 
703 731
 			// and update the class object deleted count
704 732
 			$class = null;
@@ -707,8 +735,9 @@  discard block
 block discarded – undo
707 735
 				$class->save();
708 736
 
709 737
 				// see if we need to store the change log
710
-				if ($class->hasChangeLog())
711
-					$changeLogUuid = $this->createChangeLogEntry($class, 'UNDELETE', $uuid);
738
+				if ($class->hasChangeLog()) {
739
+									$changeLogUuid = $this->createChangeLogEntry($class, 'UNDELETE', $uuid);
740
+				}
712 741
 			}
713 742
 			$this->clearCaches();
714 743
 		}
@@ -723,8 +752,9 @@  discard block
 block discarded – undo
723 752
 		if ($this->getObjectFromId($uuid, $object)) {
724 753
 			$class = null;
725 754
 			$this->findClass($object['_class_type'], $class);
726
-			if ($class && $class->hasChangeLog())
727
-				$originalValues = $this->getObject($uuid);
755
+			if ($class && $class->hasChangeLog()) {
756
+							$originalValues = $this->getObject($uuid);
757
+			}
728 758
 
729 759
 			// delete any object table data
730 760
 			$table = $this->getTableFromClassType($object['_class_type']);
@@ -740,8 +770,9 @@  discard block
 block discarded – undo
740 770
 			// then if ok, decrement the class's object counts
741 771
 			if ($class) {
742 772
 				$class->count_total = max(0, $class->count_total - 1);
743
-				if ($object['_deleted'] == 1)
744
-					$class->count_deleted = max(0, $class->count_deleted - 1);
773
+				if ($object['_deleted'] == 1) {
774
+									$class->count_deleted = max(0, $class->count_deleted - 1);
775
+				}
745 776
 				$class->save();
746 777
 			}
747 778
 
@@ -749,8 +780,9 @@  discard block
 block discarded – undo
749 780
 			DdsLink::deleteAll(['or', ['from_id' => $uuid], ['to_id' => $uuid]]);
750 781
 
751 782
 			// and note this is in the change log
752
-			if ($class && $class->hasChangeLog())
753
-				$changeLogUuid = $this->createChangeLogEntry($class, 'DESTROY', $uuid, $originalValues);
783
+			if ($class && $class->hasChangeLog()) {
784
+							$changeLogUuid = $this->createChangeLogEntry($class, 'DESTROY', $uuid, $originalValues);
785
+			}
754 786
 
755 787
 			$this->clearCaches();
756 788
 		}
@@ -762,16 +794,18 @@  discard block
 block discarded – undo
762 794
 	public function destroyObjects(array $uuids)
763 795
 	{
764 796
 		$objects = $this->getObjectRowsFromIds($uuids);
765
-		if (count($objects) == 0)
766
-			return;
797
+		if (count($objects) == 0) {
798
+					return;
799
+		}
767 800
 
768 801
 		$objectUuids = [];
769 802
 		$objectsDeleted = [];
770 803
 		$classUuids = [];
771 804
 		foreach ($objects as $obj) {
772 805
 			$objectUuids[$obj['_uuid']] = $obj['_uuid'];
773
-			if ($obj['_deleted'] == 1)
774
-				$objectsDeleted[$obj['_class_type']][$obj['_uuid']] = $obj['_uuid'];
806
+			if ($obj['_deleted'] == 1) {
807
+							$objectsDeleted[$obj['_class_type']][$obj['_uuid']] = $obj['_uuid'];
808
+			}
775 809
 			$classUuids[$obj['_class_type']][] = $obj['_uuid'];
776 810
 		}
777 811
 
@@ -798,8 +832,9 @@  discard block
 block discarded – undo
798 832
 			// decrement the class's object counts
799 833
 			if ($class) {
800 834
 				$class->count_total = max(0, $class->count_total - count($uuids));
801
-				if (isset($objectsDeleted[$classType]))
802
-					$class->count_deleted = max(0, $class->count_deleted - count($objectsDeleted[$classType]));
835
+				if (isset($objectsDeleted[$classType])) {
836
+									$class->count_deleted = max(0, $class->count_deleted - count($objectsDeleted[$classType]));
837
+				}
803 838
 				$class->save();
804 839
 			}
805 840
 		}
@@ -827,8 +862,9 @@  discard block
 block discarded – undo
827 862
 	 */
828 863
 	private function getObjectMapManager()
829 864
 	{
830
-		if (!$this->_objectMapManager)
831
-			$this->_objectMapManager = new DdsObjectMapManager;
865
+		if (!$this->_objectMapManager) {
866
+					$this->_objectMapManager = new DdsObjectMapManager;
867
+		}
832 868
 		return $this->_objectMapManager;
833 869
 	}
834 870
 
@@ -843,14 +879,16 @@  discard block
 block discarded – undo
843 879
 		// then see if there are any multilinks to extract
844 880
 		if ($links === null) {
845 881
 			$objectIds = [];
846
-			foreach ($dataSet as $row)
847
-				$objectIds[] = $row['_uuid'];
882
+			foreach ($dataSet as $row) {
883
+							$objectIds[] = $row['_uuid'];
884
+			}
848 885
 			$links = $this->getMembersLinks($objectIds);
849 886
 		}
850 887
 		foreach ($dataSet as &$data) {
851 888
 			// convert full rows to database. Totals are left untouched
852
-			if (isset($data[$classTypeKey]))
853
-				$this->convertFromDBToPHP($data, $links[$data['_uuid']], $classTypeKey);
889
+			if (isset($data[$classTypeKey])) {
890
+							$this->convertFromDBToPHP($data, $links[$data['_uuid']], $classTypeKey);
891
+			}
854 892
 		}
855 893
 	}
856 894
 
@@ -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
 
@@ -1035,8 +1077,9 @@  discard block
 block discarded – undo
1035 1077
 		// filter down until we hit the actual filters
1036 1078
 		if (is_array($filters[0])) {
1037 1079
 			foreach ($filters as $k => &$filter) {
1038
-				if ($k === 'logic')
1039
-					continue;
1080
+				if ($k === 'logic') {
1081
+									continue;
1082
+				}
1040 1083
 				$this->createFilterClause($filter, $links, $filterKeys);
1041 1084
 			}
1042 1085
 
@@ -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
 
@@ -1188,8 +1242,9 @@  discard block
 block discarded – undo
1188 1242
 	 */
1189 1243
 	private function setMembersLinks($objectsLinks, $chunkSize)
1190 1244
 	{
1191
-		if (count($objectsLinks) === 0)
1192
-			return 0;
1245
+		if (count($objectsLinks) === 0) {
1246
+					return 0;
1247
+		}
1193 1248
 		$totalCount = 0;
1194 1249
 		$db = neon()->db;
1195 1250
 		$ddsLink = DdsLink::tableName();
@@ -1199,13 +1254,16 @@  discard block
 block discarded – undo
1199 1254
 			$deleteLinkClauses = [];
1200 1255
 			foreach ($chunkData as $fromUuid => $toMemberLinks) {
1201 1256
 				// check you've been supplied with rinky dinky data
1202
-				if (!$this->isUUID($fromUuid))
1203
-					throw new \InvalidArgumentException("The fromUuid should be a UUID64. You passed in $fromUuid");
1257
+				if (!$this->isUUID($fromUuid)) {
1258
+									throw new \InvalidArgumentException("The fromUuid should be a UUID64. You passed in $fromUuid");
1259
+				}
1204 1260
 				foreach ($toMemberLinks as $member => $toLinks) {
1205
-					if (!is_array($toLinks))
1206
-						$toLinks = [$toLinks];
1207
-					if (!$this->areUUIDs($toLinks))
1208
-						throw new \InvalidArgumentException("The toMemberLinks should be UUID64s. You passed in " . print_r($toLinks, true));
1261
+					if (!is_array($toLinks)) {
1262
+											$toLinks = [$toLinks];
1263
+					}
1264
+					if (!$this->areUUIDs($toLinks)) {
1265
+											throw new \InvalidArgumentException("The toMemberLinks should be UUID64s. You passed in " . print_r($toLinks, true));
1266
+					}
1209 1267
 					$toLinks = array_unique($toLinks);
1210 1268
 
1211 1269
 					//
@@ -1220,8 +1278,9 @@  discard block
 block discarded – undo
1220 1278
 
1221 1279
 					// prepare the new links ready for bulk insert
1222 1280
 					$count += count($toLinks);
1223
-					foreach ($toLinks as $toLink)
1224
-						$batchInsert[] = ['from_id' => $fromUuid, 'from_member' => $member, 'to_id' => $toLink];
1281
+					foreach ($toLinks as $toLink) {
1282
+											$batchInsert[] = ['from_id' => $fromUuid, 'from_member' => $member, 'to_id' => $toLink];
1283
+					}
1225 1284
 				}
1226 1285
 			}
1227 1286
 			if (count($deleteLinkClauses)) {
@@ -1230,10 +1289,12 @@  discard block
 block discarded – undo
1230 1289
 			}
1231 1290
 
1232 1291
 			$insertedCount = 0;
1233
-			if (count($batchInsert))
1234
-				$insertedCount = $db->createCommand()->batchInsert($ddsLink, ['from_id', 'from_member', 'to_id'], $batchInsert)->execute();
1235
-			if (YII_DEBUG && $insertedCount !== $count)
1236
-				throw new \Exception("The link insertion failed - $count items should have been inserted vs $insertedCount actual");
1292
+			if (count($batchInsert)) {
1293
+							$insertedCount = $db->createCommand()->batchInsert($ddsLink, ['from_id', 'from_member', 'to_id'], $batchInsert)->execute();
1294
+			}
1295
+			if (YII_DEBUG && $insertedCount !== $count) {
1296
+							throw new \Exception("The link insertion failed - $count items should have been inserted vs $insertedCount actual");
1297
+			}
1237 1298
 			$totalCount += $count;
1238 1299
 		}
1239 1300
 		return $totalCount;
@@ -1274,8 +1335,9 @@  discard block
 block discarded – undo
1274 1335
 	 */
1275 1336
 	protected function getMembersLinks(array $objectIds)
1276 1337
 	{
1277
-		if (empty($objectIds))
1278
-			return [];
1338
+		if (empty($objectIds)) {
1339
+					return [];
1340
+		}
1279 1341
 		$objectIds = array_unique($objectIds);
1280 1342
 		sort($objectIds, SORT_STRING);
1281 1343
 		$cacheKey = md5(serialize($objectIds));
@@ -1287,8 +1349,9 @@  discard block
 block discarded – undo
1287 1349
 				->asArray()
1288 1350
 				->all();
1289 1351
 			$multilinks = array_fill_keys($objectIds, []);
1290
-			foreach ($rows as $row)
1291
-				$multilinks[$row['from_id']][$row['from_member']][] = $row['to_id'];
1352
+			foreach ($rows as $row) {
1353
+							$multilinks[$row['from_id']][$row['from_member']][] = $row['to_id'];
1354
+			}
1292 1355
 			self::$_linkResultsCache[$cacheKey] = $multilinks;
1293 1356
 		}
1294 1357
 		return self::$_linkResultsCache[$cacheKey];
@@ -1305,8 +1368,9 @@  discard block
 block discarded – undo
1305 1368
 	private function createChangeLogEntry($class, $changeKey, $objectUuid, $originalValues = [], $newValues = [])
1306 1369
 	{
1307 1370
 		static $changeLog = null;
1308
-		if (!$changeLog)
1309
-			$changeLog = neon('dds')->IDdsChangeLogManagement;
1371
+		if (!$changeLog) {
1372
+					$changeLog = neon('dds')->IDdsChangeLogManagement;
1373
+		}
1310 1374
 		return $changeLog->addLogEntry($objectUuid, $class->toArray(), $changeKey, $originalValues, $newValues);
1311 1375
 	}
1312 1376
 
Please login to merge, or discard this patch.
neon/daedalus/interfaces/IDdsObjectManagement.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 * @return array  a single result set as ['start', 'length', 'total', 'rows']
232 232
 	 *   @see commitRequests for more details
233 233
 	 */
234
-	public function runSingleObjectRequest($classType, array $filters=[], array $order=[], array $limit=[], $includeDeleted=false);
234
+	public function runSingleObjectRequest($classType, array $filters = [], array $order = [], array $limit = [], $includeDeleted = false);
235 235
 
236 236
 	/**
237 237
 	 * Add an object request to the list of pending requests. Database queries can
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 *   or the resultKey has already been used. These indicate bugs in the
263 263
 	 *   calling code so better not to catch it but deal with the bugs
264 264
 	 */
265
-	public function addObjectRequest($classType, array $filters=[], array $order=[], array $limit=[], $resultKey=null, $includeDeleted=false);
265
+	public function addObjectRequest($classType, array $filters = [], array $order = [], array $limit = [], $resultKey = null, $includeDeleted = false);
266 266
 
267 267
 	/**
268 268
 	 * Return the set of object requests currently queued
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	 *   [ _uuid, _class_type, _deleted, [{$data}]]
334 334
 	 *   where 'data' is set if $inFull is true
335 335
 	 */
336
-	public function listObjects($classType, &$total=null, $includeDeleted=false, $inFull=true, $start=0, $length=100, $order=null);
336
+	public function listObjects($classType, &$total = null, $includeDeleted = false, $inFull = true, $start = 0, $length = 100, $order = null);
337 337
 
338 338
 	/**
339 339
 	 * Create a new object
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 	 * @return string   the uuid for the object
348 348
 	 * @throws exception  if anything went wrong with creating the object
349 349
 	 */
350
-	public function addObject($classType, array $data, &$changeLogId=null);
350
+	public function addObject($classType, array $data, &$changeLogId = null);
351 351
 
352 352
 	/**
353 353
 	 * Add multiple objects in bulk
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 	 *   for one batch (rows of the number defined by chunkSize). MAX_ALLOWED_PACKET refers to the total size
364 364
 	 *   of the raw SQL text sent to MySQL server.
365 365
 	 */
366
-	public function addObjects($classType, array $data, $chunkSize=1000);
366
+	public function addObjects($classType, array $data, $chunkSize = 1000);
367 367
 
368 368
 	/**
369 369
 	 * Get an object's details
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 	 * @return bool|array  returns true on successful save and
391 391
 	 *   an array of errors if it couldn't save the object
392 392
 	 */
393
-	public function editObject($uuid, array $changes, &$changeLogId=null);
393
+	public function editObject($uuid, array $changes, &$changeLogId = null);
394 394
 
395 395
 	/**
396 396
 	 * Edit a series of objects with the *same* changes
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 	 * @param string $changeLogId  if the class has a change log, this will be set
423 423
 	 *   to the change log entry uuid
424 424
 	 */
425
-	public function deleteObject($uuid, &$changeLogId=null);
425
+	public function deleteObject($uuid, &$changeLogId = null);
426 426
 
427 427
 	/**
428 428
 	 * Soft delete a set of objects.
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 	 * @param string $changeLogId  if the class has a change log, this will be set
439 439
 	 *   to the change log entry uuid
440 440
 	 */
441
-	public function undeleteObject($uuid, &$changeLogId=null);
441
+	public function undeleteObject($uuid, &$changeLogId = null);
442 442
 
443 443
 	/**
444 444
 	 * Destroy an object - this removes the data from the database can
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	 * @param string $changeLogId  if the class has a change log, this will be set
449 449
 	 *   to the change log entry uuid
450 450
 	 */
451
-	public function destroyObject($uuid, &$changeLogId=null);
451
+	public function destroyObject($uuid, &$changeLogId = null);
452 452
 
453 453
 	/**
454 454
 	 * Destroy a set of objects. This cannot be undone
Please login to merge, or discard this patch.