Passed
Push — master ( 95c50e...888032 )
by Bertrand
10:36
created
app/Http/Controllers/Auth/RegisterController.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@
 block discarded – undo
106 106
             }
107 107
 
108 108
             return redirect()->route('wizard.profile');
109
-        }catch (ValidationException $e) {
109
+        } catch (ValidationException $e) {
110 110
             $attributes = $e->validator->attributes();
111 111
             $attributes['provider'] = $provider;
112 112
             return redirect()->route('register-social-network')
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 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,13 +81,13 @@  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) {
90
-            if($request->session()->has('wiki_token')) {
89
+        if ($user->context_id === null) {
90
+            if ($request->session()->has('wiki_token')) {
91 91
                 $user->wiki_token = $request->session()->get('wiki_token');
92 92
                 $user->save();
93 93
             }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         /**
99 99
          * should be deleted dead code ?
100 100
          */
101
-        if($request->session()->has('wiki_callback')){
101
+        if ($request->session()->has('wiki_callback')) {
102 102
             $user->wiki_token = $request->session()->get('wiki_token');
103 103
             $user->save();
104 104
             $callback = urldecode($request->session()->get('wiki_callback'));
@@ -110,11 +110,11 @@  discard block
 block discarded – undo
110 110
 
111 111
     public function redirectToProvider(string $provider)
112 112
     {
113
-        if(request()->session()->has('wiki_token')) {
113
+        if (request()->session()->has('wiki_token')) {
114 114
             session()->reflash();
115 115
         }
116 116
         config(['services.'.$provider.'.redirect' => env(strtoupper($provider).'_CALLBACK')]);
117
-        if($provider === 'twitter'){
117
+        if ($provider === 'twitter') {
118 118
             return Socialite::driver($provider)->redirect();
119 119
         }
120 120
         return Socialite::driver($provider)->redirectUrl(config('services.'.$provider.'.redirect'))->redirect();
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             $user = User::where('uuid', $userId)->first();
128 128
             $this->guard()->login($user);
129 129
 
130
-            if($user->context_id !== null){
130
+            if ($user->context_id !== null) {
131 131
                 $user->wiki_token = $request->session()->get('wiki_token');
132 132
                 $user->save();
133 133
                 $callback = urldecode($request->session()->get('wiki_callback'));
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             }
136 136
 
137 137
             return redirect()->route('wizard.profile');
138
-        }catch (ValidationException $e) {
138
+        } catch (ValidationException $e) {
139 139
             $attributes = $e->validator->attributes();
140 140
             $attributes['provider'] = $provider;
141 141
             return redirect()->route('register-social-network')
Please login to merge, or discard this patch.
Src/UseCases/Domain/Auth/Services/RegisterUserFromSocialNetworkService.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     public function register(string $provider, SocialiteUser $socialiteUser)
30 30
     {
31 31
         $user = $this->userRepository->getByProvider($provider, $socialiteUser->providerId());
32
-        if(isset($user)){
32
+        if (isset($user)) {
33 33
             return [
34 34
                 'user_id' => $user->id(),
35 35
                 'provider_id' => $socialiteUser->providerId(),
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
             ];
38 38
         }
39 39
 
40
-        if($socialiteUser->email() !== null  && $socialiteUser->email() != "") {
40
+        if ($socialiteUser->email() !== null && $socialiteUser->email() != "") {
41 41
             $user = $this->userRepository->getByEmail($socialiteUser->email());
42 42
         }
43
-        if(isset($user)){
43
+        if (isset($user)) {
44 44
             $user->addProvider($provider, $socialiteUser->providerId());
45 45
             return [
46 46
                 'user_id' => $user->id(),
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -89,8 +89,9 @@
 block discarded – undo
89 89
 
90 90
         // If the user has an email, we take it for granted that Google or Facebook has already verified it:
91 91
         $email = $socialiteUser->email();
92
-        if (!empty($email))
93
-            $this->userRepository->verifyEmail($id);
92
+        if (!empty($email)) {
93
+                    $this->userRepository->verifyEmail($id);
94
+        }
94 95
 
95 96
         return [
96 97
             'user_id' => $id,
Please login to merge, or discard this patch.
app/Http/Controllers/Api/OAuthController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
     {
16 16
         $token = $request->input('wiki_token', null);
17 17
 
18
-        if($token === null || $token === ''){
18
+        if ($token === null || $token === '') {
19 19
             return ['error' => 'invalid_token'];
20 20
         }
21 21
         $user = User::where('wiki_token', $token)->first();
22 22
 
23
-        if($user === null){
23
+        if ($user === null) {
24 24
             return ['error' => 'invalid_token'];
25 25
         }
26 26
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     public function logout()
37 37
     {
38 38
         $user = Auth::user();
39
-        if(isset($user)){
39
+        if (isset($user)) {
40 40
             $user->wiki_token = '';
41 41
             $user->save();
42 42
             Auth::logout();
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/Users/Profile/FillWikiUserProfile.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     {
28 28
         $errors = [];
29 29
         $user = $this->userRepository->getByEmail($email);
30
-        if(isset($user) && $user->id() !== $userId){
30
+        if (isset($user) && $user->id() !== $userId) {
31 31
             $errors[] = ['validation.unique'];
32 32
         }
33 33
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
             'email' => $email
61 61
         ], $rules);
62 62
 
63
-        $validator->after(function () use ($validator, $errors) {
63
+        $validator->after(function() use ($validator, $errors) {
64 64
             foreach ($errors as $field => $error) {
65 65
                 $validator->errors()->add($field, $error);
66 66
             }
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/Users/GetAvatar.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,12 +27,12 @@
 block discarded – undo
27 27
         $w = $img->width();
28 28
 
29 29
         $img = Image::cache(function($image) use($pathPicture, $dim, $w, $h){
30
-            if($w <= $h) {
31
-                $image->make($pathPicture)->widen($dim, function ($constraint) {
30
+            if ($w <= $h) {
31
+                $image->make($pathPicture)->widen($dim, function($constraint) {
32 32
                     $constraint->upsize();
33 33
                 });
34
-            }else{
35
-                $image->make($pathPicture)->heighten($dim, function ($constraint) {
34
+            } else {
35
+                $image->make($pathPicture)->heighten($dim, function($constraint) {
36 36
                     $constraint->upsize();
37 37
                 });
38 38
             }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
                 $image->make($pathPicture)->widen($dim, function ($constraint) {
32 32
                     $constraint->upsize();
33 33
                 });
34
-            }else{
34
+            } else{
35 35
                 $image->make($pathPicture)->heighten($dim, function ($constraint) {
36 36
                     $constraint->upsize();
37 37
                 });
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/Shared/Model/Picture.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,17 +22,17 @@
 block discarded – undo
22 22
     {
23 23
         $relativePath = $newPath;
24 24
         $finalNewPath = storage_path().'/'.$newPath;
25
-        if(isset($this->ext)){
25
+        if (isset($this->ext)) {
26 26
             $finalNewPath = storage_path().'/'.$newPath.'.'.$this->ext;
27 27
             $relativePath = $newPath.'.'.$this->ext;
28 28
         }
29
-        if(app(PictureHandler::class)->width($this->path) > 600) {
29
+        if (app(PictureHandler::class)->width($this->path) > 600) {
30 30
             app(PictureHandler::class)->widen($this->path, $finalNewPath, 600);
31 31
             $this->relativePath = $relativePath;
32 32
             return;
33 33
         }
34 34
 
35
-        if(app(PictureHandler::class)->height($this->path) > 400) {
35
+        if (app(PictureHandler::class)->height($this->path) > 400) {
36 36
             app(PictureHandler::class)->heighten($this->path, $finalNewPath, 400);
37 37
             $this->relativePath = $relativePath;
38 38
             return;
Please login to merge, or discard this patch.
Domain/Organizations/Invitation/RespondInvitationToAnOrganization.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,23 +39,23 @@
 block discarded – undo
39 39
         $organizationToJoin = $this->organizationRepository->get($organizationId);
40 40
 
41 41
         $currentUser = $this->authGateway->current();
42
-        if(isset($currentUser) && $currentUser->email() !== $email){
42
+        if (isset($currentUser) && $currentUser->email() !== $email) {
43 43
             $action = 'logout';
44 44
             $action .= !isset($user) ? '-register' : '-login';
45 45
 
46
-            if($action == 'logout-login') {
46
+            if ($action == 'logout-login') {
47 47
                 return $this->badUserLoginToAcceptAction($action, $organizationToJoin);
48 48
             }
49 49
             return $this->returnLogoutAction($action, $organizationToJoin, $email, $firstname, $lastname);
50 50
         }
51 51
 
52 52
 
53
-        if(!isset($user)){
53
+        if (!isset($user)) {
54 54
             return $this->returnRegisterAction($organizationId, $email, $firstname, $lastname);
55 55
         }
56 56
 
57 57
         $currentUser = $this->authGateway->current();
58
-        if(!isset($currentUser)){
58
+        if (!isset($currentUser)) {
59 59
             return $this->returnLoginAction($organizationToJoin);
60 60
         }
61 61
 
Please login to merge, or discard this patch.
Domain/Organizations/Invitation/PrepareInvitationUsersInOrganization.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
         $usersLoop = $this->getUsersToProcess($users, $usersLoop, $filePathUsers);
24 24
         $errors = $imported = 0;
25 25
 
26
-        foreach($usersLoop as $userToInvite){
26
+        foreach ($usersLoop as $userToInvite) {
27 27
             $validator = $this->validateUserData($userToInvite);
28
-            if($validator->fails()){
28
+            if ($validator->fails()) {
29 29
                 $userToInvite['error'] = 'email.error.syntax';
30 30
                 $usersToProcess['users'][] = $userToInvite;
31 31
                 $errors++;
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
             list($userToInvite, $errors) = $this->checkIfUserAlreadyIn($organizationId, $userToInvite, $errors);
36 36
 
37 37
             $usersToProcess['users'][] = $userToInvite;
38
-            if(!isset($userToInvite["error"])){
38
+            if (!isset($userToInvite["error"])) {
39 39
                 $imported++;
40 40
             }
41 41
         }
Please login to merge, or discard this patch.
Src/UseCases/Domain/Organizations/Invitation/InviteUsersInOrganization.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
     {
30 30
         $invitations = [];
31 31
         $organization = $this->organizationRepository->get($organizationId);
32
-        foreach($users as $user){
32
+        foreach ($users as $user) {
33 33
             $email = $user['email'];
34 34
             $firstname = isset($user['firstname']) ? $user['firstname'] : '';
35 35
             $lastname = isset($user['lastname']) ? $user['lastname'] : '';
Please login to merge, or discard this patch.