Passed
Push — develop ( ce16e5...25cca2 )
by Benjamin
04:17
created
src/controllers/LoginAccountsController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -144,12 +144,12 @@  discard block
 block discarded – undo
144 144
             Craft::$app->getSession()->set('social.originUrl', $this->originUrl);
145 145
         }
146 146
 
147
-        $this->redirect = (string)Craft::$app->getRequest()->getParam('redirect');
147
+        $this->redirect = (string) Craft::$app->getRequest()->getParam('redirect');
148 148
 
149 149
 
150 150
         // Connect
151 151
 
152
-        $providerHandle = (string)Craft::$app->getRequest()->getParam('provider');
152
+        $providerHandle = (string) Craft::$app->getRequest()->getParam('provider');
153 153
         $plugin = Craft::$app->getPlugins()->getPlugin('social');
154 154
         $pluginSettings = $plugin->getSettings();
155 155
 
@@ -203,14 +203,14 @@  discard block
 block discarded – undo
203 203
                 $errorMsg = 'Couldn’t login.';
204 204
             }
205 205
 
206
-            Craft::error('Couldn’t login. ' . $e->getTraceAsString(), __METHOD__);
206
+            Craft::error('Couldn’t login. '.$e->getTraceAsString(), __METHOD__);
207 207
             Craft::$app->getSession()->setFlash('error', $errorMsg);
208 208
             $this->_cleanSession();
209 209
 
210 210
             return $this->redirect($this->originUrl);
211 211
         } catch (\Exception $e) {
212 212
             $errorMsg = $e->getMessage();
213
-            Craft::error('Couldn’t login. ' . $e->getTraceAsString(), __METHOD__);
213
+            Craft::error('Couldn’t login. '.$e->getTraceAsString(), __METHOD__);
214 214
             Craft::$app->getSession()->setFlash('error', $errorMsg);
215 215
             $this->_cleanSession();
216 216
 
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 
466 466
         if ($user) {
467 467
             if (Plugin::getInstance()->getSettings()->allowEmailMatch !== true) {
468
-                throw new RegistrationException('An account already exists with this email: ' . $email);
468
+                throw new RegistrationException('An account already exists with this email: '.$email);
469 469
             }
470 470
 
471 471
             return $user;
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 
497 497
         // Save user
498 498
         if (!Craft::$app->elements->saveElement($newUser)) {
499
-            Craft::error('There was a problem creating the user:' . print_r($newUser->getErrors(), true), __METHOD__);
499
+            Craft::error('There was a problem creating the user:'.print_r($newUser->getErrors(), true), __METHOD__);
500 500
             throw new RegistrationException('Craft user couldn’t be created.');
501 501
         }
502 502
 
@@ -575,13 +575,13 @@  discard block
 block discarded – undo
575 575
             $domainRejected = true;
576 576
 
577 577
             foreach ($lockDomains as $lockDomain) {
578
-                if (strpos($email, '@' . $lockDomain) !== false) {
578
+                if (strpos($email, '@'.$lockDomain) !== false) {
579 579
                     $domainRejected = false;
580 580
                 }
581 581
             }
582 582
 
583 583
             if ($domainRejected) {
584
-                throw new RegistrationException('Couldn’t register with this email (domain is not allowed): ' . $email);
584
+                throw new RegistrationException('Couldn’t register with this email (domain is not allowed): '.$email);
585 585
             }
586 586
         }
587 587
     }
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
             try {
599 599
                 $newUser->{$attribute} = Craft::$app->getView()->renderString($template, ['profile' => $profile]);
600 600
             } catch (\Exception $e) {
601
-                Craft::warning('Could not map:' . print_r([$attribute, $template, $profile, $e->getMessage()], true), __METHOD__);
601
+                Craft::warning('Could not map:'.print_r([$attribute, $template, $profile, $e->getMessage()], true), __METHOD__);
602 602
             }
603 603
         }
604 604
     }
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
                 $value = Craft::$app->getView()->renderString($template, ['profile' => $profile]);
618 618
                 $newUser->setFieldValue($attribute, $value);
619 619
             } catch (\Exception $e) {
620
-                Craft::warning('Could not map:' . print_r([$template, $profile, $e->getMessage()], true), __METHOD__);
620
+                Craft::warning('Could not map:'.print_r([$template, $profile, $e->getMessage()], true), __METHOD__);
621 621
             }
622 622
         }
623 623
     }
Please login to merge, or discard this patch.
src/services/LoginAccounts.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
             try {
271 271
                 $photoUrl = html_entity_decode(Craft::$app->getView()->renderString($userFieldMapping['photo'], ['profile' => $profile]));
272 272
             } catch (\Exception $e) {
273
-                Craft::warning('Could not map:' . print_r(['photo', $userFieldMapping['photo'], $profile, $e->getMessage()], true), __METHOD__);
273
+                Craft::warning('Could not map:'.print_r(['photo', $userFieldMapping['photo'], $profile, $e->getMessage()], true), __METHOD__);
274 274
             }
275 275
         }
276 276
 
@@ -295,14 +295,14 @@  discard block
 block discarded – undo
295 295
     {
296 296
         $filename = 'photo';
297 297
 
298
-        $tempPath = Craft::$app->path->getTempPath() . '/social/userphotos/' . $user->email . '/';
298
+        $tempPath = Craft::$app->path->getTempPath().'/social/userphotos/'.$user->email.'/';
299 299
 
300 300
         FileHelper::createDirectory($tempPath);
301 301
 
302 302
         $client = new \GuzzleHttp\Client();
303 303
 
304 304
         $response = $client->request('GET', $photoUrl, [
305
-            'save_to' => $tempPath . $filename
305
+            'save_to' => $tempPath.$filename
306 306
         ]);
307 307
 
308 308
         if ($response->getStatusCode() !== 200) {
@@ -327,15 +327,15 @@  discard block
 block discarded – undo
327 327
                     break;
328 328
 
329 329
                 default:
330
-                    throw new ImageTypeException('Image type “' . $contentTypes[0] . '” not supported');
330
+                    throw new ImageTypeException('Image type “'.$contentTypes[0].'” not supported');
331 331
             }
332 332
         } else {
333 333
             throw new ImageTypeException('Image type not supported');
334 334
         }
335 335
 
336
-        rename($tempPath . $filename, $tempPath . $filename . '.' . $extension);
336
+        rename($tempPath.$filename, $tempPath.$filename.'.'.$extension);
337 337
 
338
-        $image = Craft::$app->images->loadImage($tempPath . $filename . '.' . $extension);
338
+        $image = Craft::$app->images->loadImage($tempPath.$filename.'.'.$extension);
339 339
         $imageWidth = $image->getWidth();
340 340
         $imageHeight = $image->getHeight();
341 341
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
         $verticalMargin = ($imageHeight - $dimension) / 2;
345 345
         $image->crop($horizontalMargin, $imageWidth - $horizontalMargin, $verticalMargin, $imageHeight - $verticalMargin);
346 346
 
347
-        Craft::$app->users->saveUserPhoto($tempPath . $filename . '.' . $extension, $user, $filename . '.' . $extension);
347
+        Craft::$app->users->saveUserPhoto($tempPath.$filename.'.'.$extension, $user, $filename.'.'.$extension);
348 348
 
349 349
         return true;
350 350
     }
Please login to merge, or discard this patch.