Passed
Push — develop ( 29faa4...07e7ff )
by Neill
33:04 queued 19:04
created
neon/core/grid/query/IQuery.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 * @param mixed $value
39 39
 	 * @return $this - provide a fluent chainable interface
40 40
 	 */
41
-	public function where($column, $operator=null, $value=null);
41
+	public function where($column, $operator = null, $value = null);
42 42
 
43 43
 	/**
44 44
 	 * Add an array of key (column) => values as simple equality filters
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @param string $column
55 55
 	 * @param string $order - 'ASC' | 'DESC'
56 56
 	 */
57
-	public function addOrderBy($column, $order='DESC');
57
+	public function addOrderBy($column, $order = 'DESC');
58 58
 
59 59
 	/**
60 60
 	 * Sets the order by clause to existing clause
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @param string $column
63 63
 	 * @param string $order - 'ASC' | 'DESC'
64 64
 	 */
65
-	public function orderBy($column, $order='DESC');
65
+	public function orderBy($column, $order = 'DESC');
66 66
 
67 67
 	/**
68 68
 	 * Add a having clause to the query builder
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	 * @param mixed $value
75 75
 	 * @return $this - provide a fluent chainable interface
76 76
 	 */
77
-	public function having($column, $operator=null, $value=null);
77
+	public function having($column, $operator = null, $value = null);
78 78
 
79 79
 	/**
80 80
 	 * Create an orHaving clause
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @param mixed $value
85 85
 	 * @return $this - provide a fluent chainable interface
86 86
 	 */
87
-	public function orHaving($column, $operator=null, $value=null);
87
+	public function orHaving($column, $operator = null, $value = null);
88 88
 
89 89
 	/**
90 90
 	 * return information on the current filters applied - for mysql this may be the raw query string - for
Please login to merge, or discard this patch.
neon/core/db/ActiveRecord.php 2 patches
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.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
 	 * @param string $message - optional message to display in the exception if the fields don't exist
142 142
 	 * @throws \InvalidArgumentException if fields don;t exist on the table
143 143
 	 */
144
-	public function fieldsMustExist($fields, $message='')
144
+	public function fieldsMustExist($fields, $message = '')
145 145
 	{
146 146
 		$tableName = $this->tableName();
147
-		foreach($fields as $field) {
147
+		foreach ($fields as $field) {
148 148
 			if (!$this->hasAttribute($field))
149 149
 				throw new \InvalidArgumentException("No '$field' exists on the '$tableName' table. $message");
150 150
 		}
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	 */
290 290
 	public function hasAttributeGetter($name, &$getter)
291 291
 	{
292
-		$getter = '__get_' . $name;
292
+		$getter = '__get_'.$name;
293 293
 		return method_exists($this, $getter);
294 294
 	}
295 295
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	 */
303 303
 	public function hasAttributeSetter($name, &$setter)
304 304
 	{
305
-		$setter = '__set_' . $name;
305
+		$setter = '__set_'.$name;
306 306
 		return method_exists($this, $setter);
307 307
 	}
308 308
 
@@ -331,11 +331,11 @@  discard block
 block discarded – undo
331 331
 		}
332 332
 		// is a string - or lots of string arguments
333 333
 		// like $this->isDirty('name', 'title');
334
-		if (! is_array($attributes)) {
334
+		if (!is_array($attributes)) {
335 335
 			$attributes = func_get_args();
336 336
 		}
337 337
 
338
-		foreach($attributes as $attribute) {
338
+		foreach ($attributes as $attribute) {
339 339
 			return $this->isAttributeChanged($attribute);
340 340
 		}
341 341
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	 */
351 351
 	public function isClean($attributes = null)
352 352
 	{
353
-		return ! $this->isDirty(...func_get_args());
353
+		return !$this->isDirty(...func_get_args());
354 354
 	}
355 355
 
356 356
 	/**
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 	{
398 398
 		$query = \Neon::createObject(static::$queryClass, [get_called_class()]);
399 399
 		if (static::$softDelete) {
400
-			$query->andWhere([static::tableName() .'.'. static::DELETED => 0]);
400
+			$query->andWhere([static::tableName().'.'.static::DELETED => 0]);
401 401
 		}
402 402
 		return $query;
403 403
 	}
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	 * @param boolean $withDeleted
419 419
 	 * @return ActiveQuery
420 420
 	 */
421
-	public static function query($withDeleted=false)
421
+	public static function query($withDeleted = false)
422 422
 	{
423 423
 		return $withDeleted ? static::findWithDeleted() : static::find();
424 424
 	}
Please login to merge, or discard this patch.
neon/core/db/Migration.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @param string $comment
55 55
 	 * @return \yii\db\ColumnSchemaBuilder
56 56
 	 */
57
-	public function uuid64($comment='A uuid using base 64')
57
+	public function uuid64($comment = 'A uuid using base 64')
58 58
 	{
59 59
 		return $this->getDb()->getSchema()
60 60
 			->createColumnSchemaBuilder('char(22) CHARACTER SET latin1 COLLATE latin1_general_cs')
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 		echo "    > $action ...";
72 72
 		$time = microtime(true);
73 73
 		$function();
74
-		echo ' done (time: ' . sprintf('%.3f', microtime(true) - $time) . "s)\n";
74
+		echo ' done (time: '.sprintf('%.3f', microtime(true) - $time)."s)\n";
75 75
 	}
76 76
 
77 77
 	/**
Please login to merge, or discard this patch.
neon/core/db/Migrator.php 2 patches
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.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		}
100 100
 		foreach ($migrations as $migration) {
101 101
 			if (!$this->migrateUp($migration)) {
102
-				throw new \Exception('Migration failed : ' . $migration);
102
+				throw new \Exception('Migration failed : '.$migration);
103 103
 			}
104 104
 		}
105 105
 	}
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * @param array $applied  the set of already applied migrations
135 135
 	 * @return array   the set of new migrations to be run
136 136
 	 */
137
-	private function getNewMigrationsInPath($pathAlias, $applied, $migrationAlias=null)
137
+	private function getNewMigrationsInPath($pathAlias, $applied, $migrationAlias = null)
138 138
 	{
139 139
 		if ($migrationAlias === null)
140 140
 			$migrationAlias = $pathAlias;
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
 		if (file_exists($migrationPath)) {
144 144
 			$handle = opendir($migrationPath);
145 145
 			while (($file = readdir($handle)) !== false) {
146
-				if ($file === '.' || $file === '..' || is_dir($file) || pathinfo($file, PATHINFO_EXTENSION)!='php') {
146
+				if ($file === '.' || $file === '..' || is_dir($file) || pathinfo($file, PATHINFO_EXTENSION) != 'php') {
147 147
 					continue;
148 148
 				}
149
-				$path = $migrationPath . DIRECTORY_SEPARATOR . $file;
150
-				$migrationName = $migrationAlias . '/' . str_replace('.php', '', $file);
149
+				$path = $migrationPath.DIRECTORY_SEPARATOR.$file;
150
+				$migrationName = $migrationAlias.'/'.str_replace('.php', '', $file);
151 151
 				if (is_file($path) && !isset($applied[$migrationName])) {
152 152
 					$migrations[] = $migrationName;
153 153
 				}
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 		// try migrate up
273 273
 		$migrations = $this->getNewMigrations();
274 274
 		foreach ($migrations as $i => $migration) {
275
-			if (strpos($migration, $version . '_') === 0) {
275
+			if (strpos($migration, $version.'_') === 0) {
276 276
 				$this->actionUp($i + 1);
277 277
 
278 278
 				return self::EXIT_CODE_NORMAL;
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 		// try migrate down
283 283
 		$migrations = array_keys($this->getMigrationHistory(null));
284 284
 		foreach ($migrations as $i => $migration) {
285
-			if (strpos($migration, $version . '_') === 0) {
285
+			if (strpos($migration, $version.'_') === 0) {
286 286
 				if ($i === 0) {
287 287
 					$this->stdout("Already at '$originalVersion'. Nothing needs to be done.\n", Console::FG_YELLOW);
288 288
 				} else {
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 	/**
339 339
 	 * @inheritdoc
340 340
 	 */
341
-	public function stdout($message, $color='')
341
+	public function stdout($message, $color = '')
342 342
 	{
343 343
 		echo $message;
344 344
 	}
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 	 * @param  string  $type - can be one of 'info' | 'error' | 'danger' | 'warning' | 'success'
382 382
 	 * @return string / stream
383 383
 	 */
384
-	public function log($message, $type='info')
384
+	public function log($message, $type = 'info')
385 385
 	{
386 386
 		$colors = [
387 387
 			'info' => Console::FG_BLUE, 'warning' => Console::FG_YELLOW,
@@ -431,10 +431,10 @@  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
-			$parts = explode('_', substr($migrationPart,1)); // remove initial m
437
+			$parts = explode('_', substr($migrationPart, 1)); // remove initial m
438 438
 
439 439
 			// check it was a migration and has enough parts
440 440
 			if (count($parts) == 1) {
@@ -452,10 +452,10 @@  discard block
 block discarded – undo
452 452
 			if (!is_numeric($time) || strlen($time) != 6)
453 453
 				$time = '000000';
454 454
 			// some datetimes are YYYYMMDD and others YYMMDD. Canonicalise these
455
-			if (strlen($date)==6)
455
+			if (strlen($date) == 6)
456 456
 				$date = "20$date";
457 457
 			// turn this into 'YYYY-MM-DD HH:MM:SS' and then into a timestamp
458
-			$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);
458
+			$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 459
 			$timestamp = strtotime($dateTime);
460 460
 			if ($timestamp == false)
461 461
 				throw new \Exception("Invalid datetime in migration $migration. Date(yyyymmdd)=$date and time(hhmmss)=$time. Please fix.");
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/services/accountManager/AccountManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	public function getTenantDb()
51 51
 	{
52 52
 		// if the application does not support multi tenancy then simply return the main database
53
-		if ( ! neon()->multiTenant || ! $this->isOnMasterDomain()) {
53
+		if (!neon()->multiTenant || !$this->isOnMasterDomain()) {
54 54
 			return neon()->get('db');
55 55
 		}
56 56
 
Please login to merge, or discard this patch.
neon/core/themes/blacktie/AppAsset.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 		'theme.css',
22 22
 		'https://fonts.googleapis.com/css?family=Nunito+Sans:200,200i,300,300i,400,400i,600,600i,700,700i'
23 23
 	];
24
-	public $sourcePath = __DIR__ . '/assets';
24
+	public $sourcePath = __DIR__.'/assets';
25 25
 	public $depends = [
26 26
 		'neon\core\assets\CoreAsset',
27 27
 		'\yii\bootstrap\BootstrapAsset',
@@ -30,6 +30,6 @@  discard block
 block discarded – undo
30 30
 	public function init()
31 31
 	{
32 32
 		$info = neon()->assetManager->publish($this->sourcePath, $this->publishOptions);
33
-		neon()->view->registerJs('var NEON_THEME_URL = "' . $info[1] . '";', View::POS_HEAD, 'neonThemeData');
33
+		neon()->view->registerJs('var NEON_THEME_URL = "'.$info[1].'";', View::POS_HEAD, 'neonThemeData');
34 34
 	}
35 35
 }
Please login to merge, or discard this patch.
neon/core/themes/neon/Assets.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 		'theme.css',
22 22
 		'https://fonts.googleapis.com/css?family=Nunito+Sans:200,200i,300,300i,400,400i,600,600i,700,700i,800,900',
23 23
 	];
24
-	public $sourcePath = __DIR__ . '/assets';
24
+	public $sourcePath = __DIR__.'/assets';
25 25
 	public $depends = [
26 26
 		'\neon\core\assets\CoreAsset',
27 27
 		'\yii\bootstrap\BootstrapAsset',
@@ -30,6 +30,6 @@  discard block
 block discarded – undo
30 30
 	public function init()
31 31
 	{
32 32
 		$info = neon()->assetManager->publish($this->sourcePath, $this->publishOptions);
33
-		neon()->view->registerJs('var NEON_THEME_URL = "' . $info[1] . '";', View::POS_HEAD, 'neonThemeData');
33
+		neon()->view->registerJs('var NEON_THEME_URL = "'.$info[1].'";', View::POS_HEAD, 'neonThemeData');
34 34
 	}
35 35
 }
Please login to merge, or discard this patch.
neon/core/form/fields/Choice.php 2 patches
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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@
 block discarded – undo
153 153
 	 * Assumes a single value for the choice
154 154
 	 * @return string
155 155
 	 */
156
-	public function getValueDisplay($context='')
156
+	public function getValueDisplay($context = '')
157 157
 	{
158 158
 		$items = $this->getItems();
159 159
 		return isset($items[$this->getValue()]) ? $items[$this->getValue()] : '';
Please login to merge, or discard this patch.