Passed
Push — develop ( 29faa4...07e7ff )
by Neill
33:04 queued 19:04
created
neon/user/migrations/m170104_161200_use_baseclass_timestamps.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -5,17 +5,17 @@
 block discarded – undo
5 5
 class m170104_161200_use_baseclass_timestamps extends Migration
6 6
 {
7 7
 
8
-    public function safeUp()
9
-    {
8
+	public function safeUp()
9
+	{
10 10
 		$table = \neon\user\models\User::tableName();
11 11
 		$this->renameColumn($table, 'created_on', 'created_at');
12 12
 		$this->renameColumn($table, 'updated_on', 'updated_at');
13
-    }
13
+	}
14 14
 
15
-    public function safeDown()
16
-    {
15
+	public function safeDown()
16
+	{
17 17
 		$table = \neon\user\models\User::tableName();
18 18
 		$this->renameColumn($table, 'created_at', 'created_on');
19 19
 		$this->renameColumn($table, 'updated_at', 'updated_on');
20
-    }
20
+	}
21 21
 }
Please login to merge, or discard this patch.
neon/user/App.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	/**
126 126
 	 * @inheritdoc
127 127
 	 */
128
-	public function getDataMap($key, $query='', $filters=[], $fields=[], $start=0, $length=100)
128
+	public function getDataMap($key, $query = '', $filters = [], $fields = [], $start = 0, $length = 100)
129 129
 	{
130 130
 		if ($key === 'users') {
131 131
 			return User::getUserList($query, $filters, $fields, $start, $length);
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	 * @param array &$roles  the roles that matched
277 277
 	 * @return boolean  whether it matched any roles
278 278
 	 */
279
-	public function routeHasRoles($route, &$roles=null)
279
+	public function routeHasRoles($route, &$roles = null)
280 280
 	{
281 281
 		$roles = [];
282 282
 		foreach ($this->_routes as $r) {
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 			}
286 286
 		}
287 287
 		// allow guest access if this is the only allowed role
288
-		if (count($roles)==1 && isset($roles['?']))
288
+		if (count($roles) == 1 && isset($roles['?']))
289 289
 			return false;
290 290
 		// otherwise restrict to requiring a role if one matched
291 291
 		return (count($roles) > 0);
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -144,8 +144,9 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function getMapResults($requestKey)
146 146
 	{
147
-		if (!isset($this->_mapRequestKey[$requestKey]))
148
-			throw new \InvalidArgumentException('The provided request key "'.$requestKey.'" does not exist');
147
+		if (!isset($this->_mapRequestKey[$requestKey])) {
148
+					throw new \InvalidArgumentException('The provided request key "'.$requestKey.'" does not exist');
149
+		}
149 150
 		list($key, $ids, $fields) = $this->_mapRequestKey[$requestKey];
150 151
 		if ($key === 'users') {
151 152
 			return User::getUserList('', ['uuid' => $ids]);
@@ -255,15 +256,17 @@  discard block
 block discarded – undo
255 256
 	public function setRoles(array $roles)
256 257
 	{
257 258
 		foreach ($roles as $role => $details) {
258
-			if (!array_key_exists($role, $this->_roles))
259
-				$this->_roles[$role] = ['routes'=>[]];
259
+			if (!array_key_exists($role, $this->_roles)) {
260
+							$this->_roles[$role] = ['routes'=>[]];
261
+			}
260 262
 			if (array_key_exists('routes', $details)) {
261 263
 				foreach ($details['routes'] as $r) {
262 264
 					$this->_roles[$role]['routes'][$r] = $r;
263 265
 					$this->_routes2Roles[$r][$role] = $role;
264 266
 				}
265
-				if (array_key_exists('homeUrl', $details))
266
-					$this->_roles[$role]['homeUrl'] = $details['homeUrl'];
267
+				if (array_key_exists('homeUrl', $details)) {
268
+									$this->_roles[$role]['homeUrl'] = $details['homeUrl'];
269
+				}
267 270
 				$this->_roles[$role]['label'] = (array_key_exists('label', $details) ? $details['label'] : $role);
268 271
 			}
269 272
 		}
@@ -285,8 +288,9 @@  discard block
 block discarded – undo
285 288
 			}
286 289
 		}
287 290
 		// allow guest access if this is the only allowed role
288
-		if (count($roles)==1 && isset($roles['?']))
289
-			return false;
291
+		if (count($roles)==1 && isset($roles['?'])) {
292
+					return false;
293
+		}
290 294
 		// otherwise restrict to requiring a role if one matched
291 295
 		return (count($roles) > 0);
292 296
 	}
Please login to merge, or discard this patch.
neon/admin/services/menu/Manager.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,8 +32,9 @@
 block discarded – undo
32 32
 			$menu = $app->getMenu();
33 33
 			if ($menu !== null) {
34 34
 				if (is_int(key($menu))) {
35
-					foreach ($menu as $menuItem)
36
-						$this->add('admin', $menuItem);
35
+					foreach ($menu as $menuItem) {
36
+											$this->add('admin', $menuItem);
37
+					}
37 38
 				} else {
38 39
 					$this->add('admin', $app->getMenu());
39 40
 				}
Please login to merge, or discard this patch.
neon/admin/App.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 					['class'=>'email'],
32 32
 					['class'=>'required']
33 33
 				],
34
-				'placeholder' => 'e.g. robot@' . strtolower(setting('core', 'site_name', neon()->name)) . '.com'
34
+				'placeholder' => 'e.g. robot@'.strtolower(setting('core', 'site_name', neon()->name)).'.com'
35 35
 			],
36 36
 			'fromEmailName' => [
37 37
 				'name' => 'fromEmailName',
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 				'name' => 'sslOnly',
44 44
 				'class' => '\neon\core\form\fields\SwitchButton',
45 45
 				'label' => 'Force SSL (https) everywhere',
46
-				'hint' => 'The application will redirect all requests to secure https requests. ' .
46
+				'hint' => 'The application will redirect all requests to secure https requests. '.
47 47
 					(neon()->isDevMode() ? 'Note: You are currently in dev mode so the redirects to https will not happen' : '')
48 48
 			],
49 49
 		];
Please login to merge, or discard this patch.
neon/install/helpers/requirements.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         (for example, plural in
72 72
         <a href=\"http://www.yiiframework.com/doc-2.0/yii-i18n-formatter.html#asRelativeTime%28%29-detail\">
73 73
         Formatter::asRelativeTime()</a>) in the <code>yii\i18n\Formatter</code> class. Your current ICU version is ' .
74
-			(defined('INTL_ICU_VERSION') ? INTL_ICU_VERSION : '(ICU is missing)') . '.'
74
+			(defined('INTL_ICU_VERSION') ? INTL_ICU_VERSION : '(ICU is missing)').'.'
75 75
 	],
76 76
 	[
77 77
 		'name' => 'ICU Data version',
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         (for example, plural in
83 83
         <a href=\"http://www.yiiframework.com/doc-2.0/yii-i18n-formatter.html#asRelativeTime%28%29-detail\">
84 84
         Formatter::asRelativeTime()</a>) in the <code>yii\i18n\Formatter</code> class. Your current ICU Data version is ' .
85
-			(defined('INTL_ICU_DATA_VERSION') ? INTL_ICU_DATA_VERSION : '(ICU Data is missing)') . '.'
85
+			(defined('INTL_ICU_DATA_VERSION') ? INTL_ICU_DATA_VERSION : '(ICU Data is missing)').'.'
86 86
 	],
87 87
 	[
88 88
 		'name' => 'Fileinfo extension',
Please login to merge, or discard this patch.
neon/install/helpers/InstallHelper.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -335,7 +335,7 @@
 block discarded – undo
335 335
 	 * Check the system requirements
336 336
 	 * Returns an array of tests that detect if the system meats the requirements for Neon
337 337
 	 *
338
-	* @return array of requirement tests:
338
+	 * @return array of requirement tests:
339 339
 	 *  for e.g:
340 340
 	 *
341 341
 	 * ```php
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	public static function getLocalConfigFile()
23 23
 	{
24
-		return \Neon::getALias(DIR_CONFIG . '/env.ini');
24
+		return \Neon::getALias(DIR_CONFIG.'/env.ini');
25 25
 	}
26 26
 
27 27
 	/**
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 			0 => 'Ready Check', // (a requirements check stage)
44 44
 			1 => 'Configure', // condition=>self::hasLocalConfigFile  // create config file
45
-			2 => 'Database Install',// condition=>self::tablesExist  // install tables
45
+			2 => 'Database Install', // condition=>self::tablesExist  // install tables
46 46
 			3 => 'Account', // condition=>self::hasUserAccount // install user admin account
47 47
 			4 => 'Log In' // (just a "well done, all done", link to log in page)
48 48
 		];
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		try {
113 113
 			\Neon::$app->db->open();
114 114
 			return true;
115
-		} catch(\Exception $e) {
115
+		} catch (\Exception $e) {
116 116
 			return false;
117 117
 		}
118 118
 	}
@@ -225,14 +225,14 @@  discard block
 block discarded – undo
225 225
 	public static function getAllMigrations()
226 226
 	{
227 227
 		$migrations = ['core' => [], 'apps' => []];
228
-		foreach(neon()->getCoreApps() as $appName => $config) {
228
+		foreach (neon()->getCoreApps() as $appName => $config) {
229 229
 			$app = neon()->getApp($appName);
230 230
 			if ($app) {
231 231
 				$ms = $app->getNewMigrations();
232 232
 				$migrations['core'][$appName] = $ms;
233 233
 			}
234 234
 		}
235
-		foreach(neon()->getApps() as $appName => $config) {
235
+		foreach (neon()->getApps() as $appName => $config) {
236 236
 			$app = neon()->getApp($appName);
237 237
 			if ($app) {
238 238
 				$ms = $app->getNewMigrations();
@@ -397,11 +397,11 @@  discard block
 block discarded – undo
397 397
 	 * @return boolean
398 398
 	 * @throws \yii\db\Exception
399 399
 	 */
400
-	private static function checkForUserAccounts($super=false)
400
+	private static function checkForUserAccounts($super = false)
401 401
 	{
402 402
 		$userTable = \neon\user\models\User::tableName();
403 403
 		try {
404
-			$query = 'SELECT `id` from ' . $userTable;
404
+			$query = 'SELECT `id` from '.$userTable;
405 405
 			if ($super)
406 406
 				$query .= " WHERE `super`=1";
407 407
 			$result = neon()->db->createCommand($query)->queryOne();
Please login to merge, or discard this patch.
Braces   +6 added lines, -8 removed lines patch added patch discarded remove patch
@@ -377,14 +377,11 @@  discard block
 block discarded – undo
377 377
 			$msg = $e->getMessage();
378 378
 			if (preg_match('/\bUnknown database\b/i', $msg)) {
379 379
 				return static::ERROR_DB_UNKNOWN_DATABASE;
380
-			}
381
-			else if (preg_match('/\bUnknown .* server host\b/i', $msg)) {
380
+			} else if (preg_match('/\bUnknown .* server host\b/i', $msg)) {
382 381
 				return static::ERROR_DB_UNKNOWN_HOST;
383
-			}
384
-			else if (preg_match('/\bAccess denied for user\b/i', $msg)) {
382
+			} else if (preg_match('/\bAccess denied for user\b/i', $msg)) {
385 383
 				return static::ERROR_DB_ACCESS_DENIED;
386
-			}
387
-			else {
384
+			} else {
388 385
 				return static::ERROR_DB;
389 386
 			}
390 387
 		}
@@ -402,8 +399,9 @@  discard block
 block discarded – undo
402 399
 		$userTable = \neon\user\models\User::tableName();
403 400
 		try {
404 401
 			$query = 'SELECT `id` from ' . $userTable;
405
-			if ($super)
406
-				$query .= " WHERE `super`=1";
402
+			if ($super) {
403
+							$query .= " WHERE `super`=1";
404
+			}
407 405
 			$result = neon()->db->createCommand($query)->queryOne();
408 406
 		} catch (\yii\db\Exception $e) {
409 407
 			// if this has thrown an exception because the user table does not exist.
Please login to merge, or discard this patch.
neon/install/controllers/AccountController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 		if ($model->load(\Yii::$app->request->post()) && $model->validate()) {
36 36
 			$success = $model->createUser($user);
37 37
 			if ($success === false) {
38
-				throw new \Exception('Unable to create and save a valid user ' . print_r($user->getErrors(), true));
38
+				throw new \Exception('Unable to create and save a valid user '.print_r($user->getErrors(), true));
39 39
 			} else {
40 40
 				return $this->redirect(['/install/account/complete']);
41 41
 			}
Please login to merge, or discard this patch.
neon/install/controllers/DatabaseController.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 	 */
47 47
 	public function actionMigrations()
48 48
 	{
49
-	    ob_start();
49
+		ob_start();
50 50
 		$migrator = new \neon\core\db\Migrator();
51 51
 		$migrator->runAllMigrations();
52 52
 		$migrations = ob_get_clean();
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -106,10 +106,10 @@
 block discarded – undo
106 106
 			// show message saying no config file found
107 107
 			// and provide a button to go back to the config step /install/config
108 108
 			$errorResponse = $this->render('/install/_error.tpl', [
109
-				'message' => 'Could not find the database <strong>' . env('DB_NAME') . '</strong>',
109
+				'message' => 'Could not find the database <strong>'.env('DB_NAME').'</strong>',
110 110
 				'buttons' => [
111 111
 					[
112
-						'label' => 'Try to Create &amp; Install Database <strong>' . env('DB_NAME') . '</strong>',
112
+						'label' => 'Try to Create &amp; Install Database <strong>'.env('DB_NAME').'</strong>',
113 113
 						'url' => Url::toRoute(['/install/database/create-database']),
114 114
 						'iconClass' => 'fa fa-plus',
115 115
 						'type' => 'primary',
Please login to merge, or discard this patch.
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -26,10 +26,12 @@  discard block
 block discarded – undo
26 26
 	{
27 27
 		neon()->view->params['step'] = 2;
28 28
 
29
-		if ($this->hasLocalConfigError($errorResponse))
30
-			return $errorResponse;
31
-		if ($this->hasDatabaseError($errorResponse))
32
-			return $errorResponse;
29
+		if ($this->hasLocalConfigError($errorResponse)) {
30
+					return $errorResponse;
31
+		}
32
+		if ($this->hasDatabaseError($errorResponse)) {
33
+					return $errorResponse;
34
+		}
33 35
 
34 36
 		// check if tables have already been installed:
35 37
 		if (InstallHelper::coreInstalled()) {
@@ -123,8 +125,7 @@  discard block
 block discarded – undo
123 125
 				]
124 126
 			]);
125 127
 			return true;
126
-		}
127
-		else if ($error !== 0) {
128
+		} else if ($error !== 0) {
128 129
 			// show message saying no config file found
129 130
 			// and provide a button to go back to the config step /install/config
130 131
 			$errorResponse = $this->render('/install/_error.tpl', [
Please login to merge, or discard this patch.
neon/install/controllers/ConfigController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
 					InstallHelper::createConfigFile($installer);
54 54
 					return $this->render('_created');
55 55
 				}
56
-				return $this->render('_show', [ 'config' => InstallHelper::createConfigFileContents($installer) ]);
56
+				return $this->render('_show', ['config' => InstallHelper::createConfigFileContents($installer)]);
57 57
 			}
58 58
 		}
59 59
 		return $this->render('index', ['model'=>$installer]);
Please login to merge, or discard this patch.