Passed
Push — develop ( 29faa4...07e7ff )
by Neill
33:04 queued 19:04
created
neon/user/models/UserInvite.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@
 block discarded – undo
140 140
 	public static function getInvite($token)
141 141
 	{
142 142
 		static $_invite;
143
-		if ($_invite === null){
143
+		if ($_invite === null) {
144 144
 			$_invite = self::findOne(['token' => $token]);
145 145
 		}
146 146
 		return $_invite;
Please login to merge, or discard this patch.
neon/user/grid/UserGrid.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
 			$this->addTextColumn('impersonate')->setFilter(false);
46 46
 		// scopes
47 47
 		// $this->addScope('all','All');
48
-		$this->addScope('active','Active');
49
-		$this->addScope('pending','Pending');
50
-		$this->addScope('suspended','Suspended');
51
-		$this->addScope('banned','Banned');
48
+		$this->addScope('active', 'Active');
49
+		$this->addScope('pending', 'Pending');
50
+		$this->addScope('suspended', 'Suspended');
51
+		$this->addScope('banned', 'Banned');
52 52
 		$this->addScope('super', 'Super');
53 53
 
54 54
 		$this->setPageSize(100);
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 */
197 197
 	private function getRoles()
198 198
 	{
199
-		static $roles=null;
199
+		static $roles = null;
200 200
 		if (is_null($roles)) {
201 201
 			$roles = neon('user')->getRoles(true);
202 202
 		}
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 	 */
211 211
 	private function getRoleLabels()
212 212
 	{
213
-		static $labels=null;
213
+		static $labels = null;
214 214
 		if (is_null($labels)) {
215 215
 			$roles = $this->getRoles();
216 216
 			foreach ($roles as $role => $details)
Please login to merge, or discard this patch.
neon/user/services/apiTokenManager/JwtTokenAuth.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
 		try {
114 114
 			$jwt = (array) JWT::decode($cookieString, static::secret(), ['HS256']);
115 115
 		} catch (Exception $e) {
116
-			throw new UnauthorizedHttpException('Your request was made with invalid credentials.' . neon()->debug ? ' Can not decode JWT token' : '');
116
+			throw new UnauthorizedHttpException('Your request was made with invalid credentials.'.neon()->debug ? ' Can not decode JWT token' : '');
117 117
 		}
118 118
 		// We will compare the CSRF token in the decoded API token against the CSRF header
119 119
 		// sent with the request. If the two don't match then this request is sent from
120 120
 		// an invalid source and we won't authenticate the request for further handling.
121 121
 		if (!$this->validCsrf($jwt, $request)) {
122
-			throw new UnauthorizedHttpException('Your request was made with invalid credentials.' . neon()->debug ? ' CSRF validation failed' : '');
122
+			throw new UnauthorizedHttpException('Your request was made with invalid credentials.'.neon()->debug ? ' CSRF validation failed' : '');
123 123
 		}
124 124
 
125 125
 		return $jwt;
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	protected static function requestShouldReceiveFreshToken(Request $request)
217 217
 	{
218
-		return $request->isMethod('GET') && neon()->user->isLoggedIn() && ! $request->getIsAjax();
218
+		return $request->isMethod('GET') && neon()->user->isLoggedIn() && !$request->getIsAjax();
219 219
 	}
220 220
 
221 221
 	/**
@@ -227,6 +227,6 @@  discard block
 block discarded – undo
227 227
 	protected static function responseShouldReceiveFreshToken(Response $response)
228 228
 	{
229 229
 		// if the cookie already exists do not create another one
230
-		return ! isset($response->cookies[static::$cookieName]);
230
+		return !isset($response->cookies[static::$cookieName]);
231 231
 	}
232 232
 }
233 233
\ No newline at end of file
Please login to merge, or discard this patch.
neon/user/services/apiTokenManager/models/UserApiToken.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function getHttpBasicAuthorizationBase64()
92 92
 	{
93
-		return base64_encode($this->user_id . ':' . $this->token);
93
+		return base64_encode($this->user_id.':'.$this->token);
94 94
 	}
95 95
 
96 96
 	/**
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @param string $name
111 111
 	 * @return UserApiToken|null
112 112
 	 */
113
-	public static function generateTokenFor($userId, $name='')
113
+	public static function generateTokenFor($userId, $name = '')
114 114
 	{
115 115
 		$token = UserApiToken::getTokenRecord($userId);
116 116
 		// extra security:
Please login to merge, or discard this patch.
neon/user/services/UserManager.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	/**
48 48
 	 * @inheritdoc
49 49
 	 */
50
-	public function listUsers(Iterator &$iterator=null)
50
+	public function listUsers(Iterator &$iterator = null)
51 51
 	{
52 52
 		return $this->findUsers(null, $iterator);
53 53
 	}
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	/**
56 56
 	 * @inheritdoc
57 57
 	 */
58
-	public function searchUsers($searchString, Iterator &$iterator=null)
58
+	public function searchUsers($searchString, Iterator &$iterator = null)
59 59
 	{
60 60
 		return $this->findUsers(['like', 'username', $searchString], $iterator);
61 61
 	}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	/**
64 64
 	 * @inheritdoc
65 65
 	 */
66
-	public function addUser($username, $email, $password, $roles=[], $superuser=false)
66
+	public function addUser($username, $email, $password, $roles = [], $superuser = false)
67 67
 	{
68 68
 		$user = new UserModel;
69 69
 		$user->uuid = Hash::uuid64();
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 				'uuid'=>$user->uuid,
96 96
 				'username'=>$user->username,
97 97
 				'email'=>$user->email,
98
-				'superuser'=>(boolean)$user->super,
98
+				'superuser'=>(boolean) $user->super,
99 99
 				'status' => $user->status,
100 100
 				'roles'=>$user->getRoles()
101 101
 			];
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	{
114 114
 		$user = $this->findUserModel($uuid);
115 115
 		if ($user) {
116
-			$newValues = array_intersect_key($changes, array_flip(['email','password','roles']));
116
+			$newValues = array_intersect_key($changes, array_flip(['email', 'password', 'roles']));
117 117
 			foreach ($newValues as $key=>$value) {
118 118
 				$user->$key = $value;
119 119
 			}
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 *   for the query.
154 154
 	 * @param Iterator $iterator  an iterator to go over the query
155 155
 	 */
156
-	private function findUsers($where, Iterator &$iterator=null) 
156
+	private function findUsers($where, Iterator &$iterator = null) 
157 157
 	{
158 158
 		$iterator = $iterator ? $iterator : new Iterator;
159 159
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		}
164 164
 
165 165
 		// get the rows
166
-		$query = UserModel::find()->select(['uuid','username'])
166
+		$query = UserModel::find()->select(['uuid', 'username'])
167 167
 			->limit($iterator->length)
168 168
 			->offset($iterator->start)
169 169
 			->orderBy('username');
Please login to merge, or discard this patch.
neon/user/services/User.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 * @param int $size
227 227
 	 * @return string
228 228
 	 */
229
-	public function getGuestUserImageUrl($size=40)
229
+	public function getGuestUserImageUrl($size = 40)
230 230
 	{
231 231
 		return "//www.gravatar.com/avatar?d=mm&s=$size";
232 232
 	}
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	/**
235 235
 	 * @inheritdoc
236 236
 	 */
237
-	public function getImageUrl($size=40)
237
+	public function getImageUrl($size = 40)
238 238
 	{
239 239
 		return $this->noIdentity() ? $this->getGuestUserImageUrl($size) : $this->identity->getImageUrl($size);
240 240
 	}
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 	/**
277 277
 	 * @inheritdoc
278 278
 	 */
279
-	public function getHomeUrl($role=null)
279
+	public function getHomeUrl($role = null)
280 280
 	{
281 281
 		return $this->noIdentity() ? null : $this->identity->getHomeUrl($role);
282 282
 	}
@@ -295,13 +295,13 @@  discard block
 block discarded – undo
295 295
 		foreach ($userRoles as $ur) {
296 296
 			if (array_key_exists('homeUrl', $appRoles[$ur])) {
297 297
 				$url = $appRoles[$ur]['homeUrl'];
298
-				return parent::getReturnUrl( is_array($url) ? $url : [ $url ]);
298
+				return parent::getReturnUrl(is_array($url) ? $url : [$url]);
299 299
 			}
300 300
 		}
301 301
 
302 302
 		// use the default or application set one
303 303
 		if ($defaultUrl)
304
-			return parent::getReturnUrl( is_array($defaultUrl) ? $defaultUrl : [ $defaultUrl ] );
304
+			return parent::getReturnUrl(is_array($defaultUrl) ? $defaultUrl : [$defaultUrl]);
305 305
 
306 306
 		return parent::getReturnUrl();
307 307
 	}
Please login to merge, or discard this patch.
neon/user/services/UserInvite.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
 				return neon()->mailer->compose($templates, $templateData)
50 50
 					->setTo($user->email)
51 51
 					->setFrom([$fromAddress => $fromName])
52
-					->setSubject($siteName.' invitation for ' . $user->email)
52
+					->setSubject($siteName.' invitation for '.$user->email)
53 53
 					->send();
54 54
 			}
55 55
 		}
Please login to merge, or discard this patch.
neon/user/plugins/smarty/function.getUser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,6 +10,6 @@
 block discarded – undo
10 10
  */
11 11
 function smarty_function_getUser($params, $template)
12 12
 {
13
-	$assign = isset($params['assign'])?$params['assign']:'user';
13
+	$assign = isset($params['assign']) ? $params['assign'] : 'user';
14 14
 	$template->assign($assign, neon()->user);
15 15
 }
Please login to merge, or discard this patch.
neon/user/web/DbSession.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
  */
16 16
 class DbSession extends \yii\web\DbSession
17 17
 {
18
-	protected function composeFields($id=null, $data=null)
18
+	protected function composeFields($id = null, $data = null)
19 19
 	{
20 20
 		// NOTE: do not interact with the identity inside this call
21 21
 		// this will trigger a "session_regenerate_id(): Cannot call session save handler in a recursive manner" error
Please login to merge, or discard this patch.