Passed
Push — master ( 2b0762...9c76a8 )
by Bertrand
26:13 queued 17:43
created
app/Src/UseCases/Infra/Sql/UserRepositorySql.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -187,7 +187,7 @@
 block discarded – undo
187 187
     {
188 188
         $user = \App\User::where('uuid', $userId)->first();
189 189
         if(!isset($user)){
190
-           return;
190
+            return;
191 191
         }
192 192
         $user->markEmailAsVerified();
193 193
     }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     public function getByEmail(string $email): ?User
18 18
     {
19 19
         $record = \App\User::where('email', $email)->first();
20
-        if(!isset($record)){
20
+        if (!isset($record)) {
21 21
             return null;
22 22
         }
23 23
         $roles = $record->roles()->pluck('name')->toArray();
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     public function getById(string $id): ?User
28 28
     {
29 29
         $record = \App\User::where('uuid', $id)->first();
30
-        if(!isset($record)){
30
+        if (!isset($record)) {
31 31
             return null;
32 32
         }
33 33
         $roles = $record->roles()->pluck('name')->toArray();
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         unset($data['roles']);
60 60
         $userModel->fill($data);
61 61
 
62
-        if($oldEmail !== $data['email']){
62
+        if ($oldEmail !== $data['email']) {
63 63
             $userModel->email_verified_at = null;
64 64
             $userModel->sendEmailVerificationNotification();
65 65
         }
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
             ->offset(($page-1)*$perPage)
101 101
             ->limit($perPage)
102 102
             ->get();
103
-        if(empty($records)){
103
+        if (empty($records)) {
104 104
             return [];
105 105
         }
106 106
 
107 107
         $users = [];
108
-        foreach($records as $record){
109
-            if($record->uuid === null){
108
+        foreach ($records as $record) {
109
+            if ($record->uuid === null) {
110 110
                 $identity = new Identity(Uuid::uuid4(), $record->iemail, $record->ifirstname, $record->ilastname, null);
111 111
                 $state = new State($organizationId, null, false, []);
112 112
                 $users[] = new UserDto($identity, $state);
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
     public function getAdminOfOrganization(string $organizationId): array
133 133
     {
134 134
         $records = \App\User::role(['admin'])->where('organization_id', $organizationId)->get();
135
-        if(empty($records)){
135
+        if (empty($records)) {
136 136
             return [];
137 137
         }
138 138
         $users = [];
139
-        foreach($records as $record){
139
+        foreach ($records as $record) {
140 140
             $roles = \App\User::find($record->id)->roles()->pluck('name')->toArray();
141 141
             $users[] = new User($record->uuid, $record->email, $record->firstname, $record->lastname, $record->organization_id, $record->path_picture, $roles);
142 142
         }
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
     public function getByProvider(string $provider, string $providerId): ?User
147 147
     {
148 148
         $record = \App\User::where('providers->'.$provider, $providerId)->first();
149
-        if(!isset($record)){
149
+        if (!isset($record)) {
150 150
             return null;
151 151
         }
152 152
         $roles = $record->roles()->pluck('name')->toArray();
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     public function getStats(string $userId): Stats
157 157
     {
158 158
         $record = \App\User::where('uuid', $userId)->first();
159
-        if(isset($record) && $record->wiki_stats !== null){
159
+        if (isset($record) && $record->wiki_stats !== null) {
160 160
             return new Stats($record->wiki_stats);
161 161
         }
162 162
         return new Stats([]);
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     public function verifyEmail(string $userId)
192 192
     {
193 193
         $user = \App\User::where('uuid', $userId)->first();
194
-        if(!isset($user)){
194
+        if (!isset($user)) {
195 195
            return;
196 196
         }
197 197
         $user->markEmailAsVerified();
Please login to merge, or discard this patch.
app/Http/Middleware/IsWizardProfileAvailable.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->context_id === null){
14
+        if ($user->context_id === null) {
15 15
             return $next($request);
16 16
         }
17 17
         return redirect('/profile');
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/RegisterController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -31,19 +31,19 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $email = $firstname = $lastname = '';
33 33
 
34
-        if($request->session()->has('user_to_register')){
34
+        if ($request->session()->has('user_to_register')) {
35 35
             $user = $request->session()->get('user_to_register');
36 36
             $email = $user['email'];
37 37
             $firstname = $user['firstname'];
38 38
             $lastname = $user['lastname'];
39 39
         }
40 40
 
41
-        if($request->has('wiki_callback')){
41
+        if ($request->has('wiki_callback')) {
42 42
             session()->flash('wiki_callback', $request->input('wiki_callback'));
43 43
             session()->flash('wiki_token', $request->input('wiki_token'));
44 44
         }
45 45
 
46
-        if(session()->has('should_attach_to_organization')) {
46
+        if (session()->has('should_attach_to_organization')) {
47 47
             session()->reflash();
48 48
         }
49 49
         return view('public.auth.register', [
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
     protected function validator(array $data)
57 57
     {
58
-        if(session()->has('should_attach_to_organization')) {
58
+        if (session()->has('should_attach_to_organization')) {
59 59
             session()->reflash();
60 60
         }
61 61
         return Validator::make($data, [
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
     protected function registered(Request $request, $user)
82 82
     {
83 83
         $this->guard()->login($user, true);
84
-        if($request->session()->has('should_attach_to_organization')){
84
+        if ($request->session()->has('should_attach_to_organization')) {
85 85
             app(AttachUserToAnOrganization::class)->attach($user->uuid, $request->session()->get('should_attach_to_organization'));
86 86
         }
87 87
         $user = Auth::user();
88 88
 
89
-        if($user->context_id === null) {
89
+        if ($user->context_id === null) {
90 90
             return redirect()->route('wizard.profile');
91 91
         }
92 92
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         /**
95 95
          * should be deleted dead code ?
96 96
          */
97
-        if($request->session()->has('wiki_callback')){
97
+        if ($request->session()->has('wiki_callback')) {
98 98
             $user->wiki_token = $request->session()->get('wiki_token');
99 99
             $user->save();
100 100
             $callback = urldecode($request->session()->get('wiki_callback'));
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     public function redirectToProvider(string $provider)
108 108
     {
109 109
         config(['services.'.$provider.'.redirect' => env(strtoupper($provider).'_CALLBACK')]);
110
-        if($provider === 'twitter'){
110
+        if ($provider === 'twitter') {
111 111
             return Socialite::driver($provider)->redirect();
112 112
         }
113 113
         return Socialite::driver($provider)->redirectUrl(config('services.'.$provider.'.redirect'))->redirect();
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
             $user = User::where('uuid', $userId)->first();
121 121
             $this->guard()->login($user);
122 122
 
123
-            if($user->context_id !== null){
123
+            if ($user->context_id !== null) {
124 124
                 $user->wiki_token = $request->session()->get('wiki_token');
125 125
                 $user->save();
126 126
                 $callback = urldecode($request->session()->get('wiki_callback'));
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             }
129 129
 
130 130
             return redirect()->route('wizard.profile');
131
-        }catch (ValidationException $e) {
131
+        } catch (ValidationException $e) {
132 132
             $attributes = $e->validator->attributes();
133 133
             $attributes['provider'] = $provider;
134 134
             return redirect()->route('register-social-network')
Please login to merge, or discard this patch.
app/Http/Middleware/Authenticate.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,12 +14,12 @@
 block discarded – undo
14 14
      */
15 15
     protected function redirectTo($request)
16 16
     {
17
-        if($request->has('sso')){
17
+        if ($request->has('sso')) {
18 18
             session()->put('sso', $request->get('sso'));
19 19
             session()->put('sig', $request->get('sig'));
20 20
         }
21 21
 
22
-        if (! $request->expectsJson()) {
22
+        if (!$request->expectsJson()) {
23 23
             return route('login');
24 24
         }
25 25
     }
Please login to merge, or discard this patch.
app/Http/Middleware/FlashWikiCallback.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@
 block discarded – undo
15 15
      */
16 16
     public function handle($request, Closure $next)
17 17
     {
18
-        if(session()->has('wiki_callback')){
18
+        if (session()->has('wiki_callback')) {
19 19
             session()->keep(['wiki_callback', 'wiki_token']);
20 20
         }
21 21
 
22
-        if($request->has('sso')){
22
+        if ($request->has('sso')) {
23 23
             session()->put('sso', $request->get('sso'));
24 24
             session()->put('sig', $request->get('sig'));
25 25
         }
Please login to merge, or discard this patch.
app/Listeners/SendCustomEmailVerificationNotification.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
 {
12 12
     public function handle(Registered $event)
13 13
     {
14
-        if (($event->user->providers === null || empty($event->user->providers)) && $event->user instanceof MustVerifyEmail && ! $event->user->hasVerifiedEmail()) {
14
+        if (($event->user->providers === null || empty($event->user->providers)) && $event->user instanceof MustVerifyEmail && !$event->user->hasVerifiedEmail()) {
15 15
             $event->user->sendEmailVerificationNotification();
16 16
         }
17 17
     }
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/LoginController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function showLoginForm(Request $request)
26 26
     {
27
-        if($request->session()->has('should_attach_to_organization')) {
27
+        if ($request->session()->has('should_attach_to_organization')) {
28 28
             session()->reflash();
29 29
         }
30 30
 
31
-        if($request->has('wiki_callback')){
31
+        if ($request->has('wiki_callback')) {
32 32
             session()->flash('wiki_callback', $request->input('wiki_callback'));
33 33
             session()->flash('wiki_token', $request->input('wiki_token'));
34 34
         }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
     public function logout(Request $request)
39 39
     {
40
-        if($request->session()->has('should_attach_to_organization')) {
40
+        if ($request->session()->has('should_attach_to_organization')) {
41 41
             $shouldAttach = $request->session()->get('should_attach_to_organization');
42 42
             $shouldAttachToken = $request->session()->get('should_attach_to_organization_token');
43 43
             $linkToRedirect = $request->session()->get('should_attach_to_organization_redirect');
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
         $request->session()->regenerateToken();
51 51
 
52
-        if(isset($shouldAttach)){
52
+        if (isset($shouldAttach)) {
53 53
             $request->session()->flash('should_attach_to_organization', $shouldAttach);
54 54
             $request->session()->flash('should_attach_to_organization_token', $shouldAttachToken);
55 55
             $request->session()->flash('should_attach_to_organization_redirect', $linkToRedirect);
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
     protected function loggedOut(Request $request)
68 68
     {
69 69
         $request->session()->reflash();
70
-        if($request->session()->has('should_attach_to_organization')){
70
+        if ($request->session()->has('should_attach_to_organization')) {
71 71
             $linkToRedirect = $request->session()->get('should_attach_to_organization_redirect');
72 72
             return $request->wantsJson()
73 73
                 ? new Response('', 204)
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
 
78 78
     protected function authenticated(Request $request, $user)
79 79
     {
80
-        if($user->context_id === null){
80
+        if ($user->context_id === null) {
81 81
             return redirect()->route('wizard.profile');
82 82
         }
83 83
 
84
-        if($request->session()->has('sso')){
85
-            if(!$user->hasVerifiedEmail()){
84
+        if ($request->session()->has('sso')) {
85
+            if (!$user->hasVerifiedEmail()) {
86 86
                 $request->session()->flash('from_forum', true);
87 87
                 return redirect()->route('email.verify');
88 88
             }
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
             return redirect('discourse/sso?sso='.$sso.'&sig='.$sig);
92 92
         }
93 93
 
94
-        if($request->session()->has('wiki_callback')){
94
+        if ($request->session()->has('wiki_callback')) {
95 95
             $user->wiki_token = $request->session()->get('wiki_token');
96 96
             $user->save();
97 97
             $callback = urldecode($request->session()->get('wiki_callback'));
98 98
             return redirect($callback);
99 99
         }
100 100
 
101
-        if($request->session()->has('should_attach_to_organization') && $request->session()->get('should_attach_to_organization') !== null){
101
+        if ($request->session()->has('should_attach_to_organization') && $request->session()->get('should_attach_to_organization') !== null) {
102 102
             $token = $request->session()->get('should_attach_to_organization_token');
103 103
             $link = route('organization.invite.show').'?&token='.$token;
104 104
             return $request->wantsJson()
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
     public function redirectToProvider(string $provider)
112 112
     {
113
-        if($provider === 'twitter'){
113
+        if ($provider === 'twitter') {
114 114
             config(['services.'.$provider.'.redirect' => env(strtoupper($provider).'_CALLBACK_LOGIN')]);
115 115
             return Socialite::driver($provider)->redirect();
116 116
         }
Please login to merge, or discard this patch.
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/User.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public function adminlte_image()
38 38
     {
39 39
         $urlPicture = $this->path_picture != "" ? asset('storage/'.str_replace('app/public/', '', $this->path_picture)) : null;
40
-        if(!isset($urlPicture) || $urlPicture === ""){
40
+        if (!isset($urlPicture) || $urlPicture === "") {
41 41
             $urlPicture = url('').'/'.config('adminlte.logo_img');
42 42
         }
43 43
         return $urlPicture;
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     public function adminlte_desc()
47 47
     {
48 48
         $desc = $this->firstname.' '.$this->lastname;
49
-        if($this->organization_id !== null){
49
+        if ($this->organization_id !== null) {
50 50
             $organization = app(OrganizationRepository::class)->get($this->organization_id);
51 51
             $desc .= ' - organisme : '.$organization->name();
52 52
         }
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
     public function sendEmailVerificationNotification()
77 77
     {
78 78
         $callback = '';
79
-        if(session()->has('wiki_callback')){
79
+        if (session()->has('wiki_callback')) {
80 80
             $callback = base64_encode(urldecode(session()->get('wiki_callback')));
81 81
         }
82 82
 
83
-        if(session()->has('sso')){
83
+        if (session()->has('sso')) {
84 84
             $sso = session()->get('sso');
85 85
             $sig = session()->get('sig');
86 86
             $callback = base64_encode(url('discourse/sso?sso='.$sso.'&sig='.$sig));
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 
106 106
     public function addCharacteristics(array $characteristics)
107 107
     {
108
-        foreach($characteristics as $characteristicUuid){
109
-            $characteristic = CharacteristicsModel::where('uuid', (string)$characteristicUuid)->first();
110
-            if(isset($characteristic)) {
108
+        foreach ($characteristics as $characteristicUuid) {
109
+            $characteristic = CharacteristicsModel::where('uuid', (string) $characteristicUuid)->first();
110
+            if (isset($characteristic)) {
111 111
                 $this->characteristics()->save($characteristic);
112 112
             }
113 113
         }
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
     public function syncCharacteristics(array $characteristics)
117 117
     {
118 118
         $characteristicsToSync = [];
119
-        foreach($characteristics as $characteristicUuid){
120
-            $characteristicModel = CharacteristicsModel::where('uuid', (string)$characteristicUuid)->first();
121
-            if(isset($characteristicModel)) {
119
+        foreach ($characteristics as $characteristicUuid) {
120
+            $characteristicModel = CharacteristicsModel::where('uuid', (string) $characteristicUuid)->first();
121
+            if (isset($characteristicModel)) {
122 122
                 $characteristicsToSync[] = $characteristicModel->id;
123 123
             }
124 124
         }
Please login to merge, or discard this patch.