Passed
Push — develop ( 29faa4...07e7ff )
by Neill
33:04 queued 19:04
created
neon/core/grid/PhoebeDataProvider.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,10 +42,12 @@  discard block
 block discarded – undo
42 42
 
43 43
 	public function init()
44 44
 	{
45
-		if (empty($this->phoebeType))
46
-			throw new \RuntimeException('PhoebeDataProvider: the phoebe type has not been set. It needs to be set on construction');
47
-		if (empty($this->classType))
48
-			throw new \RuntimeException('PhoebeDataProvider: the phoebe class type has not been set. It needs to be set on construction');
45
+		if (empty($this->phoebeType)) {
46
+					throw new \RuntimeException('PhoebeDataProvider: the phoebe type has not been set. It needs to be set on construction');
47
+		}
48
+		if (empty($this->classType)) {
49
+					throw new \RuntimeException('PhoebeDataProvider: the phoebe class type has not been set. It needs to be set on construction');
50
+		}
49 51
 	}
50 52
 
51 53
 	/**
@@ -142,8 +144,9 @@  discard block
 block discarded – undo
142 144
 	 */
143 145
 	protected function getFormDefinition()
144 146
 	{
145
-		if ($this->formDefinition == null)
146
-			$this->formDefinition = neon('phoebe')->getFormDefinition($this->phoebeType, $this->classType);
147
+		if ($this->formDefinition == null) {
148
+					$this->formDefinition = neon('phoebe')->getFormDefinition($this->phoebeType, $this->classType);
149
+		}
147 150
 		return $this->formDefinition;
148 151
 	}
149 152
 
Please login to merge, or discard this patch.
neon/core/grid/YiiActiveDataProvider.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,8 @@
 block discarded – undo
40 40
 	public function __clone()
41 41
 	{
42 42
 		parent::__clone();
43
-		if ($this->_queryBuilder)
44
-			$this->_queryBuilder = clone $this->_queryBuilder;
43
+		if ($this->_queryBuilder) {
44
+					$this->_queryBuilder = clone $this->_queryBuilder;
45
+		}
45 46
 	}
46 47
 }
47 48
\ No newline at end of file
Please login to merge, or discard this patch.
neon/core/grid/GridRenderer.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -133,13 +133,15 @@
 block discarded – undo
133 133
 		$pagination = $this->_grid->getDataProvider()->getPagination();
134 134
 		$filters = [];
135 135
 		foreach($this->_grid->getFilterForm()->getFields() as $field) {
136
-			if (!empty($field->getValue()))
137
-				$filters[$field->getInputName()] = $field->getValue();
136
+			if (!empty($field->getValue())) {
137
+							$filters[$field->getInputName()] = $field->getValue();
138
+			}
138 139
 		}
139 140
 		$queryParams = neon()->request->queryParams;
140 141
 		// remove any pre existing grid specific filters from the url - we don't want to add them twice
141
-		if (isset($queryParams[$this->_grid->gridName()]))
142
-			unset($queryParams[$this->_grid->gridName()]);
142
+		if (isset($queryParams[$this->_grid->gridName()])) {
143
+					unset($queryParams[$this->_grid->gridName()]);
144
+		}
143 145
 		// gross - we need to remove any pre existing filters from the query params
144 146
 		$pagination->params = $queryParams + $filters;
145 147
 
Please login to merge, or discard this patch.
neon/core/grid/PhoebeGrid.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -124,8 +124,9 @@
 block discarded – undo
124 124
 	 */
125 125
 	public function getDataProvider()
126 126
 	{
127
-		if (!$this->_dataProvider)
128
-			throw new \RuntimeException('You need to call phoebeLoadGrid before the grid can be used');
127
+		if (!$this->_dataProvider) {
128
+					throw new \RuntimeException('You need to call phoebeLoadGrid before the grid can be used');
129
+		}
129 130
 		return $this->_dataProvider;
130 131
 	}
131 132
 
Please login to merge, or discard this patch.
neon/core/grid/query/YiiQuery.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,10 +30,11 @@
 block discarded – undo
30 30
 		if (is_array($column)) {
31 31
 			return $this->addArrayOfWheres($column);
32 32
 		}
33
-		if ($operator==='=')
34
-			$this->_activeQuery->andWhere([$column => $value]);
35
-		else
36
-			$this->_activeQuery->andWhere([$operator, $column, $value]);
33
+		if ($operator==='=') {
34
+					$this->_activeQuery->andWhere([$column => $value]);
35
+		} else {
36
+					$this->_activeQuery->andWhere([$operator, $column, $value]);
37
+		}
37 38
 		return $this;
38 39
 	}
39 40
 
Please login to merge, or discard this patch.
neon/core/db/ActiveRecord.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -147,8 +147,9 @@
 block discarded – undo
147 147
 	{
148 148
 		$tableName = $this->tableName();
149 149
 		foreach($fields as $field) {
150
-			if (!$this->hasAttribute($field))
151
-				throw new \InvalidArgumentException("No '$field' exists on the '$tableName' table. $message");
150
+			if (!$this->hasAttribute($field)) {
151
+							throw new \InvalidArgumentException("No '$field' exists on the '$tableName' table. $message");
152
+			}
152 153
 		}
153 154
 	}
154 155
 
Please login to merge, or discard this patch.
neon/core/db/Migrator.php 1 patch
Braces   +25 added lines, -19 removed lines patch added patch discarded remove patch
@@ -113,8 +113,9 @@  discard block
 block discarded – undo
113 113
 	public function getNewMigrationsForApp($appName)
114 114
 	{
115 115
 		$app = Neon::$app->getApp($appName);
116
-		if ($app === null)
117
-			throw new \Exception('No app exists with id "'.$appName.'"');
116
+		if ($app === null) {
117
+					throw new \Exception('No app exists with id "'.$appName.'"');
118
+		}
118 119
 		$alias = $app->getClassAlias().'/migrations';
119 120
 		$migrationAlias = $app->getMigrationAlias().'/migrations';
120 121
 		$applied = [];
@@ -136,8 +137,9 @@  discard block
 block discarded – undo
136 137
 	 */
137 138
 	private function getNewMigrationsInPath($pathAlias, $applied, $migrationAlias=null)
138 139
 	{
139
-		if ($migrationAlias === null)
140
-			$migrationAlias = $pathAlias;
140
+		if ($migrationAlias === null) {
141
+					$migrationAlias = $pathAlias;
142
+		}
141 143
 		$migrations = [];
142 144
 		$migrationPath = Neon::getAlias($pathAlias);
143 145
 		if (file_exists($migrationPath)) {
@@ -402,9 +404,7 @@  discard block
 block discarded – undo
402 404
 				$string = $prefix.$message;
403 405
 			}
404 406
 			return Console::stdout("$string\n");
405
-		}
406
-
407
-		else {
407
+		} else {
408 408
 			return $message;
409 409
 		}
410 410
 	}
@@ -431,15 +431,17 @@  discard block
 block discarded – undo
431 431
 		foreach ($migrations as $migration) {
432 432
 			// remove any paths to get the migration itself
433 433
 			$migrationPart = $migration;
434
-			if (strpos($migration,'/')!==false)
435
-				$migrationPart = substr($migration, strrpos($migration,'/')+1);
434
+			if (strpos($migration,'/')!==false) {
435
+							$migrationPart = substr($migration, strrpos($migration,'/')+1);
436
+			}
436 437
 
437 438
 			$parts = explode('_', substr($migrationPart,1)); // remove initial m
438 439
 
439 440
 			// check it was a migration and has enough parts
440 441
 			if (count($parts) == 1) {
441
-				if (!is_numeric($parts[0]))
442
-					continue;
442
+				if (!is_numeric($parts[0])) {
443
+									continue;
444
+				}
443 445
 				$date = $parts[0];
444 446
 				$time = '000000';
445 447
 			} else {
@@ -449,24 +451,28 @@  discard block
 block discarded – undo
449 451
 
450 452
 			// some handwritten migrations have bad datetimes
451 453
 			// capture case where no time has been set or is actually a date
452
-			if (!is_numeric($time) || strlen($time) != 6)
453
-				$time = '000000';
454
+			if (!is_numeric($time) || strlen($time) != 6) {
455
+							$time = '000000';
456
+			}
454 457
 			// some datetimes are YYYYMMDD and others YYMMDD. Canonicalise these
455
-			if (strlen($date)==6)
456
-				$date = "20$date";
458
+			if (strlen($date)==6) {
459
+							$date = "20$date";
460
+			}
457 461
 			// turn this into 'YYYY-MM-DD HH:MM:SS' and then into a timestamp
458 462
 			$dateTime = substr($date,0,4)."-".substr($date,4,2)."-".substr($date,6,2)." ".substr($time,0,2).":".substr($time,2,2).":".substr($time,4,2);
459 463
 			$timestamp = strtotime($dateTime);
460
-			if ($timestamp == false)
461
-				throw new \Exception("Invalid datetime in migration $migration. Date(yyyymmdd)=$date and time(hhmmss)=$time. Please fix.");
464
+			if ($timestamp == false) {
465
+							throw new \Exception("Invalid datetime in migration $migration. Date(yyyymmdd)=$date and time(hhmmss)=$time. Please fix.");
466
+			}
462 467
 			// beware migrations with same timestamp
463 468
 			$sortableMigrations[$timestamp][] = $migration;
464 469
 		}
465 470
 		ksort($sortableMigrations);
466 471
 		$sortedMigrations = [];
467 472
 		foreach ($sortableMigrations as $mgs) {
468
-			foreach ($mgs as $mig)
469
-				$sortedMigrations[] = $mig;
473
+			foreach ($mgs as $mig) {
474
+							$sortedMigrations[] = $mig;
475
+			}
470 476
 		}
471 477
 		return $sortedMigrations;
472 478
 	}
Please login to merge, or discard this patch.
neon/core/services/Formatter.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,14 +42,16 @@
 block discarded – undo
42 42
 		parent::init();
43 43
 		// the main config can set this - but it can also be loaded by application settings (and possibly user setting in future)
44 44
 		$this->dateFormat = setting('settings', 'dateFormat', $this->dateFormat);
45
-		if ($this->dateFormat === 'custom')
46
-			$this->dateFormat = setting('settings', 'dateFormatCustom', $this->dateFormat);
45
+		if ($this->dateFormat === 'custom') {
46
+					$this->dateFormat = setting('settings', 'dateFormatCustom', $this->dateFormat);
47
+		}
47 48
 
48 49
 		$this->timeFormat = setting('settings', 'timeFormat', $this->timeFormat);
49 50
 		$this->nullDisplay = setting('settings', 'nullDisplay', $this->nullDisplay);
50 51
 		$this->datetimeFormat = setting('settings', 'datetimeFormat', $this->datetimeFormat);
51
-		if ($this->datetimeFormat === 'custom')
52
-			$this->datetimeFormat = setting('settings', 'datetimeFormatCustom', $this->datetimeFormat);
52
+		if ($this->datetimeFormat === 'custom') {
53
+					$this->datetimeFormat = setting('settings', 'datetimeFormatCustom', $this->datetimeFormat);
54
+		}
53 55
 	}
54 56
 
55 57
 	/**
Please login to merge, or discard this patch.
neon/core/form/fields/Choice.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -105,8 +105,9 @@
 block discarded – undo
105 105
 	public function getItemsDisplay()
106 106
 	{
107 107
 		$items = $this->getItems();
108
-		foreach ($items as $key => $value)
109
-			$items[$key] = '<span class="neonField_labelText">'.$value.'</span>';
108
+		foreach ($items as $key => $value) {
109
+					$items[$key] = '<span class="neonField_labelText">'.$value.'</span>';
110
+		}
110 111
 		return $items;
111 112
 	}
112 113
 
Please login to merge, or discard this patch.