Test Setup Failed
Branch user/international-postal-code... (b53ac3)
by Bertrand
08:58
created
app/Http/Middleware/CheckEmailVerified.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
     public function handle($request, Closure $next)
12 12
     {
13 13
         $user = Auth::user();
14
-        if(!$user->hasVerifiedEmail()){
14
+        if (!$user->hasVerifiedEmail()) {
15 15
             $request->session()->flash('from_forum', true);
16 16
             return redirect()->route('verification.notice');
17 17
         }
Please login to merge, or discard this patch.
app/Observers/PageObserver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 
24 24
     public function deleted(PageModel $pageModel)
25 25
     {
26
-        Log::info('Deleting all data from the page internal id: ' . $pageModel->id);
27
-        DB::transaction(function () use($pageModel){
26
+        Log::info('Deleting all data from the page internal id: '.$pageModel->id);
27
+        DB::transaction(function() use($pageModel){
28 28
             try {
29 29
                 $characteristic = CharacteristicsModel::query()->where('page_id', $pageModel->page_id)->first();
30 30
                 if (isset($characteristic)) {
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
                     UserCharacteristicsModel::query()->where('characteristic_id', $characteristic->id)->delete();
37 37
                 }
38 38
             } catch (\Throwable $e) {
39
-                Log::emergency('Error deleting all data from the page internal id: ' . $pageModel->id);
39
+                Log::emergency('Error deleting all data from the page internal id: '.$pageModel->id);
40 40
                 throw $e;
41 41
             }
42 42
         });
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/Gateway/SocialiteGatewayImpl.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,31 +12,31 @@
 block discarded – undo
12 12
 {
13 13
     public function user(string $provider): SocialiteUser
14 14
     {
15
-        if($provider === 'twitter'){
15
+        if ($provider === 'twitter') {
16 16
             $user = Socialite::driver($provider)->user();
17
-        }elseif($provider === 'facebook'){
17
+        }elseif ($provider === 'facebook') {
18 18
             $user = Socialite::driver($provider)->fields(['name', 'first_name', 'last_name', 'email'])->user();
19
-        }else {
19
+        } else {
20 20
             $user = Socialite::driver($provider)->stateless()->user();
21 21
         }
22 22
 
23 23
         $email = $user->getEmail();
24 24
 
25 25
         // For twitter, we prefer to use the name. If empty we'll use the twitter account (nickname):
26
-        $firstname = $user->getName() !== null ? $user->getName() :  $user->getNickname();
27
-        if(!empty($user->user['given_name'])){
26
+        $firstname = $user->getName() !== null ? $user->getName() : $user->getNickname();
27
+        if (!empty($user->user['given_name'])) {
28 28
             // Google
29 29
             $firstname = $user->user['given_name'];
30
-        }elseif (!empty($user->user['first_name'])){
30
+        }elseif (!empty($user->user['first_name'])) {
31 31
             // Facebook
32 32
             $firstname = $user->user['first_name'];
33 33
         }
34 34
 
35 35
         $lastname = $user->getName();
36
-        if(!empty($user->user['family_name'])){
36
+        if (!empty($user->user['family_name'])) {
37 37
             // Google
38 38
             $lastname = $user->user['family_name'];
39
-        }elseif (!empty($user->user['last_name'])){
39
+        }elseif (!empty($user->user['last_name'])) {
40 40
             // Facebook
41 41
             $lastname = $user->user['last_name'];
42 42
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,9 +14,9 @@  discard block
 block discarded – undo
14 14
     {
15 15
         if($provider === 'twitter'){
16 16
             $user = Socialite::driver($provider)->user();
17
-        }elseif($provider === 'facebook'){
17
+        } elseif($provider === 'facebook'){
18 18
             $user = Socialite::driver($provider)->fields(['name', 'first_name', 'last_name', 'email'])->user();
19
-        }else {
19
+        } else {
20 20
             $user = Socialite::driver($provider)->stateless()->user();
21 21
         }
22 22
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         if(!empty($user->user['given_name'])){
28 28
             // Google
29 29
             $firstname = $user->user['given_name'];
30
-        }elseif (!empty($user->user['first_name'])){
30
+        } elseif (!empty($user->user['first_name'])){
31 31
             // Facebook
32 32
             $firstname = $user->user['first_name'];
33 33
         }
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         if(!empty($user->user['family_name'])){
37 37
             // Google
38 38
             $lastname = $user->user['family_name'];
39
-        }elseif (!empty($user->user['last_name'])){
39
+        } elseif (!empty($user->user['last_name'])){
40 40
             // Facebook
41 41
             $lastname = $user->user['last_name'];
42 42
         }
Please login to merge, or discard this patch.
app/Console/Commands/Debug/TestMailers.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     protected $description = 'Add email to newsletter';
14 14
 
15 15
     public function handle(SendinBlueService $sendinBlueService,
16
-                           MailerLiteService $mailerLiteService)
16
+                            MailerLiteService $mailerLiteService)
17 17
     {
18 18
         $email = $this->argument('email');
19 19
 
Please login to merge, or discard this patch.
app/Console/Commands/ImportCharacteristicsFromWiki.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         $content = $wikiClient->searchCharacteristics($opt);
56 56
         $characteristics = $content['query']['results'];
57 57
 
58
-        foreach ($characteristics as  $characteristic){
58
+        foreach ($characteristics as  $characteristic) {
59 59
             $page = key($characteristic);
60 60
             $this->info(sprintf("Importing %s", $page));
61 61
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
             $icon = '';
65 65
             $uuid = Uuid::uuid4();
66
-            if(isset($characteristic['printouts']['A un glyph'][0])) {
66
+            if (isset($characteristic['printouts']['A un glyph'][0])) {
67 67
                 $icon = $characteristic['printouts']['A un glyph'][0];
68 68
             }
69 69
 
@@ -77,21 +77,21 @@  discard block
 block discarded – undo
77 77
             $characteristicsToSave = [
78 78
                 'uuid' => $uuid,
79 79
                 'main' => $main,
80
-                'priority' => (int)last($characteristic['printouts']['A une priorité d\'affichage']),
80
+                'priority' => (int) last($characteristic['printouts']['A une priorité d\'affichage']),
81 81
                 'icon' => $icon,
82 82
                 'page_label' => $label,
83 83
                 'pretty_page_label' => $prettyPage,
84
-                'page_id' => (int)$pageInfo['pageid'],
84
+                'page_id' => (int) $pageInfo['pageid'],
85 85
                 'type' => $type,
86 86
                 'code' => $pageInfo['title'],
87 87
                 'wiki' => strtolower($wikiCode),
88 88
             ];
89 89
 
90 90
             $model = CharacteristicsModel::query()
91
-                ->where('page_id', (int)$pageInfo['pageid'])
91
+                ->where('page_id', (int) $pageInfo['pageid'])
92 92
                 ->where('wiki', $wikiCode)
93 93
                 ->first();
94
-            if(!isset($model)) {
94
+            if (!isset($model)) {
95 95
                 $model = new CharacteristicsModel();
96 96
             }
97 97
             $model->fill($characteristicsToSave);
Please login to merge, or discard this patch.
app/Console/Commands/SyncUsersDiscourse.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
             ->where('lastname', '<>', '')
39 39
             ->whereNotNull('email_verified_at')
40 40
             ->whereNull('sync_at_discourse')
41
-            ->chunkById(50, function ($items) use ($clients) {
42
-                foreach($items as $user) {
41
+            ->chunkById(50, function($items) use ($clients) {
42
+                foreach ($items as $user) {
43 43
                     $this->processOneUser($clients, $user);
44 44
                 }
45 45
             });
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
             $this->updateUserDetailsOnDiscourse($user);
61 61
             $user->sync_at_discourse = (new \DateTime())->format('Y-m-d H:i:s');
62 62
             $user->save();
63
-        } catch (\Throwable $e){
63
+        } catch (\Throwable $e) {
64 64
             if ($e->getCode() === 429) {
65 65
                 // Too many requests - just sleeping
66 66
                 $this->error('Too many requests - restarting in a minute....');
67 67
                 sleep(60);
68 68
             } else {
69
-                $message = 'Discourse sync failed for user : ' . $user->uuid . ' [' . $e->getCode() . '] ' . $e->getMessage();
69
+                $message = 'Discourse sync failed for user : '.$user->uuid.' ['.$e->getCode().'] '.$e->getMessage();
70 70
                 $this->error($message);
71 71
                 \Sentry\captureException($e);
72 72
             }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         $username = $this->formatUsername($user, $increment);
83 83
 
84 84
         $result = $this->forumApiClient->createUser($username, $user);
85
-        if($result['success'] === false){
85
+        if ($result['success'] === false) {
86 86
             if (!empty($result['errors']['email'])) {
87 87
                 return $this->updateUsernameFromDiscourse($user);
88 88
             }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
             throw $th;
122 122
         }
123 123
 
124
-        if(empty($result['user'])){
124
+        if (empty($result['user'])) {
125 125
             throw new \Exception('Duplicate email not corresponding to existing user');
126 126
         }
127 127
         $user->discourse_id = $result['user']['id'];
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     {
146 146
         $result = $this->forumApiClient->getUserByEmail($user->email);
147 147
 
148
-        if(empty($result[0]['email']) || strtolower($result[0]['email']) != strtolower($user->email)){
148
+        if (empty($result[0]['email']) || strtolower($result[0]['email']) != strtolower($user->email)) {
149 149
             throw new \Exception('Duplicate email not corresponding to existing user');
150 150
         }
151 151
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     {
163 163
         try {
164 164
             $this->forumApiClient->updateEmail($user->discourse_username, $user->email);
165
-        }catch (\Throwable $e){
165
+        } catch (\Throwable $e) {
166 166
             $this->error('User email not updated on discourse with id : '.$user->discourse_username);
167 167
         }
168 168
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 
181 181
         $result = $this->forumApiClient->updateUser($user, $newBio);
182 182
 
183
-        if($result['success'] === false){
183
+        if ($result['success'] === false) {
184 184
             $this->error('Not Updating bio : '.$result['message']);
185 185
             throw new \Exception($result['message']);
186 186
         }
@@ -198,11 +198,11 @@  discard block
 block discarded – undo
198 198
      */
199 199
     public function formatUsername(User $user, int $increment): string
200 200
     {
201
-        $username = trim(substr((string)Str::of($user->fullname)->slug('.'), 0, 20), '.');
201
+        $username = trim(substr((string) Str::of($user->fullname)->slug('.'), 0, 20), '.');
202 202
         if (empty($username)) {
203 203
             throw new \Exception("Empty username", 55);
204 204
         }
205 205
 
206
-        return !empty($increment) ? $username . $increment : $username;
206
+        return !empty($increment) ? $username.$increment : $username;
207 207
     }
208 208
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@
 block discarded – undo
162 162
     {
163 163
         try {
164 164
             $this->forumApiClient->updateEmail($user->discourse_username, $user->email);
165
-        }catch (\Throwable $e){
165
+        } catch (\Throwable $e){
166 166
             $this->error('User email not updated on discourse with id : '.$user->discourse_username);
167 167
         }
168 168
 
Please login to merge, or discard this patch.
app/Console/Commands/SyncDryPagesFromWiki.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,16 +27,16 @@
 block discarded – undo
27 27
             PageModel::query()
28 28
                 ->where('dry', true)
29 29
                 ->where('wiki', $wikiCode)
30
-                ->chunkById(50, function ($items, $count) use($client){
30
+                ->chunkById(50, function($items, $count) use($client){
31 31
                     $this->info(($count*50).' Pages');
32 32
                     $pages = $items->pluck('page_id')->toArray();
33 33
                     $content = $client->searchPagesById($pages);
34 34
                     $wikiPages = $content['query']['pages'];
35 35
 
36
-                    foreach($wikiPages as $page){
36
+                    foreach ($wikiPages as $page) {
37 37
                         $pageModel = PageModel::query()->where('page_id', $page['pageid'])->first();
38 38
 
39
-                        if(!isset($pageModel)){
39
+                        if (!isset($pageModel)) {
40 40
                             continue;
41 41
                         }
42 42
 
Please login to merge, or discard this patch.
app/Listeners/AddEmailToNewsletter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@
 block discarded – undo
28 28
         try {
29 29
             $this->sendingBlueService->addEmailToList($verified->user->email, $verified->user->lastname, $verified->user->firstname);
30 30
         } catch (\Throwable $e) {
31
-            Log::critical('Error when adding email to sending blue : ' . $verified->user->email);
31
+            Log::critical('Error when adding email to sending blue : '.$verified->user->email);
32 32
         }
33 33
         try {
34 34
             $this->mailerLiteService->addEmailToList($verified->user->email);
35 35
         } catch (\Exception $e) {
36
-            Log::critical('Error when adding email to mailerlite : ' . $verified->user->email);
36
+            Log::critical('Error when adding email to mailerlite : '.$verified->user->email);
37 37
         }
38 38
     }
39 39
 }
Please login to merge, or discard this patch.
app/Listeners/SetUserToSyncOnDiscourse.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@
 block discarded – undo
13 13
     {
14 14
         try {
15 15
             $user = $verified->user;
16
-            if(empty($user->firstname) || empty($user->lastname)){
16
+            if (empty($user->firstname) || empty($user->lastname)) {
17 17
                 return;
18 18
             }
19 19
 
20 20
             $user->sync_at_discourse = null;
21 21
             $user->save();
22
-        }catch (\Throwable $e){
22
+        } catch (\Throwable $e) {
23 23
             Log::emergency('Error when sync asking for user : '.$user->id);
24 24
             \Sentry\captureException($e);
25 25
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 
20 20
             $user->sync_at_discourse = null;
21 21
             $user->save();
22
-        }catch (\Throwable $e){
22
+        } catch (\Throwable $e){
23 23
             Log::emergency('Error when sync asking for user : '.$user->id);
24 24
             \Sentry\captureException($e);
25 25
         }
Please login to merge, or discard this patch.