Passed
Push — develop ( 44d21a...7d51f9 )
by Neill
34:25 queued 18:25
created
neon/daedalus/services/ddsManager/DdsObjectManager.php 1 patch
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.
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.