Passed
Push — develop ( 29faa4...07e7ff )
by Neill
33:04 queued 19:04
created
neon/daedalus/interfaces/IDdsChangeLogManagement.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @param \neon\core\helpers\Iterator $iterator  Iterate over the results.
64 64
 	 * @return array  the change log data
65 65
 	 */
66
-	public function listChangeLog($fromDate=null, Iterator $iterator=null);
66
+	public function listChangeLog($fromDate = null, Iterator $iterator = null);
67 67
 
68 68
 	/**
69 69
 	 * List an object's change log, if the object's class has been set up to store changes
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 * @return If the object's class is set to have a change log, this will return the
74 74
 	 *   change log for this object. Otherwise it will return a blank array.
75 75
 	 */
76
-	public function listObjectChangeLog($uuid, $fromDate=null, Iterator $iterator=null);
76
+	public function listObjectChangeLog($uuid, $fromDate = null, Iterator $iterator = null);
77 77
 
78 78
 	/**
79 79
 	 * List the history of an object, if the object's class has been set up to store changes.
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @return If the object's class is set to have a change log, this will return the
85 85
 	 *   history for this object. Otherwise it will return a blank array.
86 86
 	 */
87
-	public function listObjectHistory($uuid, $fromDate=null, Iterator $iterator=null);
87
+	public function listObjectHistory($uuid, $fromDate = null, Iterator $iterator = null);
88 88
 
89 89
 	/**
90 90
 	 * Clear change log to a certain date and optionally for particular class types
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 *   then the $classList is the set of log items to be preserved and all
99 99
 	 *   others are cleared.
100 100
 	 */
101
-	public function clearChangeLog($toDate, $classList=[], $clearClassList=true);
101
+	public function clearChangeLog($toDate, $classList = [], $clearClassList = true);
102 102
 
103 103
 	/**
104 104
 	 * Clear an object's change log
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 *   This can be empty, if the item was deleted or destroyed for example.
125 125
 	 * @return string  the uuid of the created log entry
126 126
 	 */
127
-	public function addLogEntry($objectUuid, $class, $changeKey, $before=[], $after=[]);
127
+	public function addLogEntry($objectUuid, $class, $changeKey, $before = [], $after = []);
128 128
 
129 129
 	/**
130 130
 	 * Get the log entry
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * @param array $associateObjectUuids  any associated objects that are related to the principal one.
164 164
 	 * @return string  the uuid of the created log entry
165 165
 	 */
166
-	public function addGeneralComment($module, $classType, $comment, $objectUuid=null, array $associateObjectUuids=[]);
166
+	public function addGeneralComment($module, $classType, $comment, $objectUuid = null, array $associateObjectUuids = []);
167 167
 
168 168
 	/**
169 169
 	 * Get an object's value at a particular log point.
Please login to merge, or discard this patch.
neon/daedalus/interfaces/IDdsObjectMapManagement.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * @throw \InvalidArgumentException  if the class type does not exist
72 72
 	 * @throw \RuntimeException  if the map field does not exist
73 73
 	 */
74
-	public function getObjectMap($classType, $filters=[], $mapFields=[], $start=0, $length=1000, $includeDeleted=false);
74
+	public function getObjectMap($classType, $filters = [], $mapFields = [], $start = 0, $length = 1000, $includeDeleted = false);
75 75
 
76 76
 
77 77
 	/**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @return string $requestKey  returns a unique request key so the results can be
92 92
 	 *   found after committing.
93 93
 	 */
94
-	public function makeMapLookupRequest($objectUuids, $mapFields=[], $classType=null);
94
+	public function makeMapLookupRequest($objectUuids, $mapFields = [], $classType = null);
95 95
 
96 96
 	/**
97 97
 	 * Get hold of the requested map lookup
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 *   found after committing. @see getMapChainLookupResult for the data structure
134 134
 	 *   returned
135 135
 	 */
136
-	public function makeMapChainLookupRequest($objectUuids, $chainMembers=[], $chainMapFields=[], $inReverse=false);
136
+	public function makeMapChainLookupRequest($objectUuids, $chainMembers = [], $chainMapFields = [], $inReverse = false);
137 137
 
138 138
 	/**
139 139
 	 * Commit the map requests stored so that all object chains are resolved
Please login to merge, or discard this patch.
neon/daedalus/interfaces/IDdsAppMigrator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,6 +52,6 @@
 block discarded – undo
52 52
 	 * @param boolean $delete  if set to true, then the migration is deleted
53 53
 	 *   regardless of whether or not any migrations were stored
54 54
 	 */
55
-	public function closeMigrationFile($delete=false);
55
+	public function closeMigrationFile($delete = false);
56 56
 
57 57
 }
58 58
\ No newline at end of file
Please login to merge, or discard this patch.
neon/daedalus/interfaces/IDdsObjectManagement.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -301,10 +301,10 @@
 block discarded – undo
301 301
 	public function commitRequests();
302 302
 
303 303
  	/**
304
-	 * Extract data from the last committed requests
305
-	 * @param string $requestKey  the request key you want to extract for
306
-	 * @return array  the requested data or [] if none
307
-	 */
304
+ 	 * Extract data from the last committed requests
305
+ 	 * @param string $requestKey  the request key you want to extract for
306
+ 	 * @return array  the requested data or [] if none
307
+ 	 */
308 308
 	public function getLastCommitData($requestKey);
309 309
 
310 310
 
Please login to merge, or discard this 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.
neon/daedalus/interfaces/IDdsDataTypeManagement.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 	 *   any deleted datatyes
26 26
 	 * @return an array data types
27 27
 	 */
28
-	public function listDataTypes($includeDeleted=false);
28
+	public function listDataTypes($includeDeleted = false);
29 29
 
30 30
 	/**
31 31
 	 * Create a datatype.
Please login to merge, or discard this patch.
neon/daedalus/interfaces/IDdsQueryHelpers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,5 +17,5 @@
 block discarded – undo
17 17
 	 *   does and has been deleted.
18 18
 	 * @return mixed
19 19
 	 */
20
-	public function addObjectDeletionChecksOnJoin(\yii\db\Query $query, $tables, $join='innerJoin');
20
+	public function addObjectDeletionChecksOnJoin(\yii\db\Query $query, $tables, $join = 'innerJoin');
21 21
 }
22 22
\ No newline at end of file
Please login to merge, or discard this patch.
neon/daedalus/grid/ChangeLogGrid.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 		$this->addDateColumn('when')->setWidth("10em");
46 46
 
47 47
 		$this->addButtonColumn('View')
48
-			->addButton('view', ['/daedalus/change-log/view-object' , 'uuid' => '{{object_uuid}}', 'logUuid' => '{{log_uuid}}'], '', 'fa fa-eye', '', ['data-toggle' => 'tooltip', 'title'=>'View Object']);
48
+			->addButton('view', ['/daedalus/change-log/view-object', 'uuid' => '{{object_uuid}}', 'logUuid' => '{{log_uuid}}'], '', 'fa fa-eye', '', ['data-toggle' => 'tooltip', 'title'=>'View Object']);
49 49
 
50 50
 		$this->setPageSize(100);
51 51
 	}
Please login to merge, or discard this patch.
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,19 +23,23 @@
 block discarded – undo
23 23
 	{
24 24
 		$this->query = (new \yii\db\Query())
25 25
 			->from('{{dds_change_log}}');
26
-		if ($this->classType)
27
-			$this->query->where(['class_type'=>$this->classType]);
28
-		if ($this->objectUuid)
29
-			$this->query->andWhere(['object_uuid'=>$this->objectUuid]);
26
+		if ($this->classType) {
27
+					$this->query->where(['class_type'=>$this->classType]);
28
+		}
29
+		if ($this->objectUuid) {
30
+					$this->query->andWhere(['object_uuid'=>$this->objectUuid]);
31
+		}
30 32
 		$this->query->orderBy(['when'=>SORT_DESC, 'log_id'=>SORT_DESC]);
31 33
 
32
-		if (!$this->classType)
33
-			$this->title = 'Full Change Log';
34
-		else
35
-			$this->title = 'Change Log for class '.$this->classType;
34
+		if (!$this->classType) {
35
+					$this->title = 'Full Change Log';
36
+		} else {
37
+					$this->title = 'Change Log for class '.$this->classType;
38
+		}
36 39
 
37
-		if ($this->objectUuid)
38
-			$this->title .= " and object '$this->objectUuid'";
40
+		if ($this->objectUuid) {
41
+					$this->title .= " and object '$this->objectUuid'";
42
+		}
39 43
 
40 44
 		$this->addTextColumn('log_uuid')->setWidth("10em");
41 45
 		$this->addTextColumn('object_uuid')->setWidth("10em");
Please login to merge, or discard this patch.
neon/daedalus/services/ddsChangeLog/DdsChangeLogManager.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	public function hasChangeLog($classType)
47 47
 	{
48 48
 		if ($this->findClass($classType, $class)) {
49
-			return (boolean)$class->hasChangeLog();
49
+			return (boolean) $class->hasChangeLog();
50 50
 		}
51 51
 		return false;
52 52
 	}
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	public function setChangeLog($classType, $to)
58 58
 	{
59
-		$to = (boolean)$to;
59
+		$to = (boolean) $to;
60 60
 		if ($this->findClass($classType, $class)) {
61
-			$hasChangeLog = (boolean)$class->hasChangeLog();
61
+			$hasChangeLog = (boolean) $class->hasChangeLog();
62 62
 			// only change if different to current
63 63
 			if ($hasChangeLog !== $to) {
64 64
 				neon('dds')->IDdsClassManagement->editClass($classType, ['change_log'=>$to]);
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 					'log_uuid' => Hash::uuid64(),
73 73
 					'class_type' => $class['class_type'],
74 74
 					'change_key' => 'COMMENT',
75
-					'description' => sprintf($description, ($to?'ON':'OFF')),
75
+					'description' => sprintf($description, ($to ? 'ON' : 'OFF')),
76 76
 					'who' => $whoUid,
77 77
 					'when' => date('Y-m-d H:i:s'),
78 78
 				])->execute();
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	/**
85 85
 	 * @inheritdoc
86 86
 	 */
87
-	public function listChangeLog($fromDate=null, Iterator $iterator=null)
87
+	public function listChangeLog($fromDate = null, Iterator $iterator = null)
88 88
 	{
89 89
 		return $this->getChangeLog($fromDate, $iterator, null);
90 90
 	}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	/**
93 93
 	 * @inheritdoc
94 94
 	 */
95
-	public function listObjectChangeLog($uuid, $fromDate=null, Iterator $iterator=null)
95
+	public function listObjectChangeLog($uuid, $fromDate = null, Iterator $iterator = null)
96 96
 	{
97 97
 		return $this->getChangeLog($fromDate, $iterator, $uuid);
98 98
 	}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	/**
101 101
 	 * @inheritdoc
102 102
 	 */
103
-	public function listObjectHistory($uuid, $fromDate=null, Iterator $iterator=null)
103
+	public function listObjectHistory($uuid, $fromDate = null, Iterator $iterator = null)
104 104
 	{
105 105
 		$changeLog = $this->getChangeLog($fromDate, $iterator, $uuid);
106 106
 		return $this->convertChangeLogToHistory($uuid, $changeLog);
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 	/**
110 110
 	 * @inheritdoc
111 111
 	 */
112
-	public function clearChangeLog($toDate, $classList=[], $clearClassList=true)
112
+	public function clearChangeLog($toDate, $classList = [], $clearClassList = true)
113 113
 	{
114 114
 		$deleteConditions = '[[when]] <= :toDate';
115
-		$bindValues = [ ':toDate'=>$toDate ];
115
+		$bindValues = [':toDate'=>$toDate];
116 116
 		if (!empty($classList)) {
117 117
 			$clearClause = ($clearClassList ? '' : '!');
118 118
 			$deleteConditions .= " AND $clearClause([[class_type]]=:".implode(" OR [[class_type]]=:", $classList).")";
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	public function clearObjectChangeLog($uuid, $toDate)
133 133
 	{
134 134
 		$deleteConditions = '[[when]] <= :toDate AND [[object_uuid]] = :uuid';
135
-		$bindValues = [ ':toDate'=>$toDate, ':uuid' => $uuid ];
135
+		$bindValues = [':toDate'=>$toDate, ':uuid' => $uuid];
136 136
 		neon()->db->createCommand()
137 137
 			->delete('{{dds_change_log}}', $deleteConditions)
138 138
 			->bindValues($bindValues)
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 	/**
143 143
 	 * @inheritdoc
144 144
 	 */
145
-	public function addLogEntry($objectUuid, $class, $changeKey, $before=[], $after=[])
145
+	public function addLogEntry($objectUuid, $class, $changeKey, $before = [], $after = [])
146 146
 	{
147 147
 		if (!in_array($changeKey, $this->changeLogEntryActions))
148 148
 			throw new \InvalidArgumentException('Invalid change key in addLogEntry. Allowed values are ['.implode(', ', $this->changeLogEntryActions));
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 	/**
250 250
 	 * @inheritdoc
251 251
 	 */
252
-	public function addGeneralComment($module, $classType, $comment, $objectUuid=null, array $associateObjectUuids=[])
252
+	public function addGeneralComment($module, $classType, $comment, $objectUuid = null, array $associateObjectUuids = [])
253 253
 	{
254 254
 		// check we can make a comment
255 255
 		if (empty($comment))
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 	 * @throws \RuntimeException  if the restore point could not be reached
349 349
 	 *   using a sensible number of change log points (<=1000).
350 350
 	 */
351
-	private function getChangeLog($fromDate, $iterator, $objectUuid, $logId=null)
351
+	private function getChangeLog($fromDate, $iterator, $objectUuid, $logId = null)
352 352
 	{
353 353
 		$fromDate = ($fromDate === null ? date('Y-m-d 00:00:00') : $fromDate);
354 354
 		$iterator = ($iterator === null ? new Iterator : $iterator);
@@ -398,9 +398,9 @@  discard block
 block discarded – undo
398 398
 	 */
399 399
 	private function convertFromDb(&$entry)
400 400
 	{
401
-		$entry['before'] = json_decode($entry['before'],true);
402
-		$entry['after'] = json_decode($entry['after'],true);
403
-		$entry['associated_objects'] = json_decode($entry['associated_objects'],true);
401
+		$entry['before'] = json_decode($entry['before'], true);
402
+		$entry['after'] = json_decode($entry['after'], true);
403
+		$entry['associated_objects'] = json_decode($entry['associated_objects'], true);
404 404
 	}
405 405
 
406 406
 	/**
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 * @param array &$currentObject  the value of the current object
413 413
 	 * @return array  a history log
414 414
 	 */
415
-	private function convertChangeLogToHistory($uuid, $log, &$currentObject=[])
415
+	private function convertChangeLogToHistory($uuid, $log, &$currentObject = [])
416 416
 	{
417 417
 		// get the current object and work backwards from there to get history
418 418
 		// first see if we can the object and if not check that the last action
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 		}
550 550
 		$before = $beforeChangedFields;
551 551
 		$after = $afterChangedFields;
552
-		return count($after)>0;
552
+		return count($after) > 0;
553 553
 	}
554 554
 
555 555
 	/**
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 	 */
609 609
 	private function isEquivalentBoolean($before, $after)
610 610
 	{
611
-		return (is_bool($before) && (bool)($after) == $before);
611
+		return (is_bool($before) && (bool) ($after) == $before);
612 612
 	}
613 613
 
614 614
 	/**
@@ -621,8 +621,8 @@  discard block
 block discarded – undo
621 621
 	 */
622 622
 	private function isEquivalentNull($before, $after)
623 623
 	{
624
-		if ($before === null || $before === '' || (is_array($before) && count($before)==0))
625
-			return ($after === null || $after === '' || (is_array($after) && count($after)==0));
624
+		if ($before === null || $before === '' || (is_array($before) && count($before) == 0))
625
+			return ($after === null || $after === '' || (is_array($after) && count($after) == 0));
626 626
 		return false;
627 627
 	}
628 628
 
Please login to merge, or discard this patch.
Braces   +57 added lines, -38 removed lines patch added patch discarded remove patch
@@ -144,14 +144,16 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function addLogEntry($objectUuid, $class, $changeKey, $before=[], $after=[])
146 146
 	{
147
-		if (!in_array($changeKey, $this->changeLogEntryActions))
148
-			throw new \InvalidArgumentException('Invalid change key in addLogEntry. Allowed values are ['.implode(', ', $this->changeLogEntryActions));
147
+		if (!in_array($changeKey, $this->changeLogEntryActions)) {
148
+					throw new \InvalidArgumentException('Invalid change key in addLogEntry. Allowed values are ['.implode(', ', $this->changeLogEntryActions));
149
+		}
149 150
 
150 151
 		$class = $this->getClass($class);
151 152
 
152 153
 		// check the class does have a change log
153
-		if (!$class['change_log'])
154
-			return;
154
+		if (!$class['change_log']) {
155
+					return;
156
+		}
155 157
 
156 158
 		// get who this was
157 159
 		$whoUid = $name = null;
@@ -167,8 +169,9 @@  discard block
 block discarded – undo
167 169
 			break;
168 170
 			case 'EDIT':
169 171
 				$changeCount = $this->calculateMinimumFieldsChangedDuringEdit($before, $after);
170
-				if ($changeCount == 0)
171
-					return;
172
+				if ($changeCount == 0) {
173
+									return;
174
+				}
172 175
 				$description = sprintf($baseDescription, 'edited an')
173 176
 					." The fields changed were ['".implode("', '", array_keys($after))."'].";
174 177
 			break;
@@ -213,8 +216,9 @@  discard block
 block discarded – undo
213 216
 			$entry = neon()->db->createCommand("SELECT * FROM {{dds_change_log}} WHERE [[log_uuid]] = :logUuid")
214 217
 				->bindParam(":logUuid", $logUuid)
215 218
 				->queryOne();
216
-			if ($entry)
217
-				$this->convertFromDb($entry);
219
+			if ($entry) {
220
+							$this->convertFromDb($entry);
221
+			}
218 222
 			return $entry;
219 223
 		}
220 224
 		return null;
@@ -227,8 +231,9 @@  discard block
 block discarded – undo
227 231
 	{
228 232
 		// check this has a change log
229 233
 		$class = $this->getClassFromObject($objectUuid);
230
-		if (empty($class) || !$class['change_log'])
231
-			return;
234
+		if (empty($class) || !$class['change_log']) {
235
+					return;
236
+		}
232 237
 
233 238
 		// find out who did this
234 239
 		$whoUid = $name = null;
@@ -252,8 +257,9 @@  discard block
 block discarded – undo
252 257
 	public function addGeneralComment($module, $classType, $comment, $objectUuid=null, array $associateObjectUuids=[])
253 258
 	{
254 259
 		// check we can make a comment
255
-		if (empty($comment))
256
-			return;
260
+		if (empty($comment)) {
261
+					return;
262
+		}
257 263
 
258 264
 		// find out who did this
259 265
 		$whoUid = $name = null;
@@ -280,8 +286,9 @@  discard block
 block discarded – undo
280 286
 	{
281 287
 		$initialObject = $restorePoint = null;
282 288
 		$this->calculateObjectAtRestorePoint($objectUuid, $logEntryUuid, $initialObject, $restorePoint);
283
-		if ($restorePoint)
284
-			return $restorePoint['object'];
289
+		if ($restorePoint) {
290
+					return $restorePoint['object'];
291
+		}
285 292
 		return [];
286 293
 	}
287 294
 
@@ -315,8 +322,9 @@  discard block
 block discarded – undo
315 322
 			$dds->editObject($objectUuid, $restoreObject);
316 323
 		}
317 324
 		// and make a log entry
318
-		if (!empty($restorePoint))
319
-			$this->addLogEntry($objectUuid, $restorePoint['class_type'], 'RESTORE', $initialObject, $restorePoint);
325
+		if (!empty($restorePoint)) {
326
+					$this->addLogEntry($objectUuid, $restorePoint['class_type'], 'RESTORE', $initialObject, $restorePoint);
327
+		}
320 328
 	}
321 329
 
322 330
 
@@ -360,8 +368,9 @@  discard block
 block discarded – undo
360 368
 			->orderBy(['log_id'=>SORT_DESC]);
361 369
 
362 370
 		// check for a particular object if required
363
-		if ($objectUuid)
364
-			$query->andWhere(['object_uuid'=>$objectUuid]);
371
+		if ($objectUuid) {
372
+					$query->andWhere(['object_uuid'=>$objectUuid]);
373
+		}
365 374
 
366 375
 		// start from a particular log id point
367 376
 		if ($logId) {
@@ -373,8 +382,9 @@  discard block
 block discarded – undo
373 382
 		// and check sensible limits
374 383
 		$query->limit($iterator->length)
375 384
 			->offset($iterator->start);
376
-		if ($iterator->shouldReturnTotal())
377
-			$iterator->total = $query->count();
385
+		if ($iterator->shouldReturnTotal()) {
386
+					$iterator->total = $query->count();
387
+		}
378 388
 
379 389
 		$changeLog = $query->all();
380 390
 
@@ -421,8 +431,9 @@  discard block
 block discarded – undo
421 431
 		$lastAction = $this->getLastActionFromLog($log);
422 432
 		if ($currentObject == null) {
423 433
 			$currentObject = [];
424
-			if (!($lastAction == 'DESTROY' || $lastAction == 'RESTORE'))
425
-				return [];
434
+			if (!($lastAction == 'DESTROY' || $lastAction == 'RESTORE')) {
435
+							return [];
436
+			}
426 437
 		}
427 438
 		$object = $currentObject;
428 439
 		$objectHistory = [];
@@ -456,8 +467,9 @@  discard block
 block discarded – undo
456 467
 	private function getLastActionFromLog($log)
457 468
 	{
458 469
 		foreach ($log as $l) {
459
-			if (!in_array($l['change_key'], $this->changeLogEntryActions))
460
-				continue;
470
+			if (!in_array($l['change_key'], $this->changeLogEntryActions)) {
471
+							continue;
472
+			}
461 473
 			return $l['change_key'];
462 474
 		}
463 475
 		return null;
@@ -500,17 +512,20 @@  discard block
 block discarded – undo
500 512
 		static $ddc = null;
501 513
 
502 514
 		// see if this is already an array in which case no need to look up
503
-		if (is_array($class))
504
-			return $class;
515
+		if (is_array($class)) {
516
+					return $class;
517
+		}
505 518
 
506 519
 		// otherwise check this is a string for a class type
507
-		if (!is_string($class))
508
-			throw new \InvalidArgumentException("Invalid type of class passed in. Should be either a string or an array. Type passed in was ".gettype($class));
520
+		if (!is_string($class)) {
521
+					throw new \InvalidArgumentException("Invalid type of class passed in. Should be either a string or an array. Type passed in was ".gettype($class));
522
+		}
509 523
 
510 524
 		// and get hold of the class
511 525
 		if (!isset($classes[$class])) {
512
-			if (empty($ddc))
513
-				$ddc = neon('dds')->IDdsClassManagement;
526
+			if (empty($ddc)) {
527
+							$ddc = neon('dds')->IDdsClassManagement;
528
+			}
514 529
 			$classes[$class] = $ddc->getClass($class);
515 530
 		}
516 531
 		return $classes[$class];
@@ -537,8 +552,9 @@  discard block
 block discarded – undo
537 552
 			if (array_key_exists($k, $before)) {
538 553
 				$b = $before[$k];
539 554
 				// check for a few expected changes that aren't actual changes
540
-				if ($this->isEquivalentNull($b, $v) || $this->isEquivalentBoolean($b, $v) || $this->isEquivalentChoice($b, $v))
541
-					continue;
555
+				if ($this->isEquivalentNull($b, $v) || $this->isEquivalentBoolean($b, $v) || $this->isEquivalentChoice($b, $v)) {
556
+									continue;
557
+				}
542 558
 				if ($v !== $before[$k]) {
543 559
 					$beforeChangedFields[$k] = $b;
544 560
 					$afterChangedFields[$k] = $v;
@@ -566,10 +582,12 @@  discard block
 block discarded – undo
566 582
 		$restorePoint = neon()->db->createCommand("SELECT * FROM dds_change_log WHERE log_uuid = :log_uuid")
567 583
 			->bindValue(':log_uuid', $logEntryUuid)
568 584
 			->queryOne();
569
-		if (!$restorePoint)
570
-			throw new \InvalidArgumentException("The requested log point ($logEntryUuid) doesn't exist.");
571
-		if ($objectUuid != $restorePoint['object_uuid'])
572
-			throw new \InvalidArgumentException("The requested object ($objectUuid) and the object at the log point ($logEntryUuid) don't match");
585
+		if (!$restorePoint) {
586
+					throw new \InvalidArgumentException("The requested log point ($logEntryUuid) doesn't exist.");
587
+		}
588
+		if ($objectUuid != $restorePoint['object_uuid']) {
589
+					throw new \InvalidArgumentException("The requested object ($objectUuid) and the object at the log point ($logEntryUuid) don't match");
590
+		}
573 591
 
574 592
 		$initialObject = null;
575 593
 		$changeLog = $this->getChangeLog($restorePoint['when'], null, $objectUuid, $restorePoint['log_id']);
@@ -621,8 +639,9 @@  discard block
 block discarded – undo
621 639
 	 */
622 640
 	private function isEquivalentNull($before, $after)
623 641
 	{
624
-		if ($before === null || $before === '' || (is_array($before) && count($before)==0))
625
-			return ($after === null || $after === '' || (is_array($after) && count($after)==0));
642
+		if ($before === null || $before === '' || (is_array($before) && count($before)==0)) {
643
+					return ($after === null || $after === '' || (is_array($after) && count($after)==0));
644
+		}
626 645
 		return false;
627 646
 	}
628 647
 
Please login to merge, or discard this patch.
neon/daedalus/services/ddsAppMigrator/DdsAppMigratorFactory.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,9 @@
 block discarded – undo
18 18
 	 */
19 19
 	public static function createMigrator($path)
20 20
 	{
21
-		if (self::$migrator == null)
22
-			self::$migrator = new DdsAppMigrator($path);
21
+		if (self::$migrator == null) {
22
+					self::$migrator = new DdsAppMigrator($path);
23
+		}
23 24
 		return self::$migrator;
24 25
 	}
25 26
 
Please login to merge, or discard this patch.