Passed
Push — master ( b93f0b...feb66d )
by Bertrand
05:42
created
app/Http/Controllers/UsersController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,12 +26,12 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function listUsers(string $organizationId, Request $request, ListUsers $listUsers)
28 28
     {
29
-        $page = $request->input('start')/10 + 1;
29
+        $page = $request->input('start')/10+1;
30 30
 
31 31
         $users = $listUsers->list($organizationId, $page, 10);
32 32
         $total = init($users['total'], 0);
33 33
         $list = [];
34
-        foreach ($users['list'] as $user){
34
+        foreach ($users['list'] as $user) {
35 35
             $user = $user->toArray();
36 36
             $list[] = [
37 37
                 '',
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     public function editShowForm(string $userId, GetUser $getUser, GetOrganization $getOrganization, GetUserStats $getUserStats)
52 52
     {
53 53
         $user = $getUser->get($userId);
54
-        if($user->organizationId() !== null) {
54
+        if ($user->organizationId() !== null) {
55 55
             $organization = $getOrganization->get($user->organizationId());
56 56
         }
57 57
         $stats = $getUserStats->get($userId);
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
     public function delete(string $userId, Request $request, DeleteUser $deleteUser)
89 89
     {
90 90
         $redirect = 'back';
91
-        if($userId === Auth::id()){
91
+        if ($userId === Auth::id()) {
92 92
             $redirect = 'login';
93 93
         }
94 94
         $deleteUser->delete($userId);
95
-        if($redirect === 'login') {
95
+        if ($redirect === 'login') {
96 96
             return redirect()->route('login');
97 97
         }
98 98
         $request->session()->flash('notif_msg', __('users.message.user.deleted'));
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/Gateway/Real/RealSocialiteGateway.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,15 +12,15 @@
 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
-        }else {
17
+        } else {
18 18
             $user = Socialite::driver($provider)->stateless()->user();
19 19
         }
20 20
 
21 21
         $email = $user->getEmail();
22 22
         $firstname = $user->getNickname() !== null ? $user->getNickname() : $user->getName();
23
-        if(isset($user->user['given_name'])){
23
+        if (isset($user->user['given_name'])) {
24 24
             $firstname = $user->user['given_name'];
25 25
         }
26 26
         $lastname = isset($user->user['family_name']) ? $user->user['family_name'] : $user->getName();
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
     {
15 15
         if($provider === 'twitter'){
16 16
             $user = Socialite::driver($provider)->user();
17
-        }else {
17
+        } else {
18 18
             $user = Socialite::driver($provider)->stateless()->user();
19 19
         }
20 20
 
Please login to merge, or discard this patch.
app/Providers/AppServiceProvider.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -36,31 +36,31 @@
 block discarded – undo
36 36
     {
37 37
         $this->registerHelpers();
38 38
 
39
-        if(config('app.env') === 'testing'){
39
+        if (config('app.env') === 'testing') {
40 40
             $this->tuBinding();
41 41
         }
42
-        if(config('app.env') === 'testing-ti'){
42
+        if (config('app.env') === 'testing-ti') {
43 43
             $this->tiBinding();
44 44
         }
45
-        if(config('app.env') === 'local' || config('app.env') === 'production'){
45
+        if (config('app.env') === 'local' || config('app.env') === 'production') {
46 46
             $this->prodBinding();
47 47
         }
48 48
     }
49 49
 
50 50
     public function boot()
51 51
     {
52
-        if(config('app.env') !== 'testing' && config('app.env') !== 'testing-ti') {
52
+        if (config('app.env') !== 'testing' && config('app.env') !== 'testing-ti') {
53 53
             Schema::defaultStringLength(191);
54 54
         }
55 55
 
56
-        if(config('app.env') === 'local' || config('app.env') === 'production'){
56
+        if (config('app.env') === 'local' || config('app.env') === 'production') {
57 57
             URL::forceScheme('https');
58 58
         }
59 59
     }
60 60
 
61 61
     private function registerHelpers(): void
62 62
     {
63
-        foreach (glob(app_path() . '/Src/Utils/Helpers/*.php') as $filename) {
63
+        foreach (glob(app_path().'/Src/Utils/Helpers/*.php') as $filename) {
64 64
             require_once($filename);
65 65
         }
66 66
     }
Please login to merge, or discard this patch.
app/Http/Middleware/TransformRequestLoginProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,14 +9,14 @@
 block discarded – undo
9 9
     public function handle($request, Closure $next, $guard = null)
10 10
     {
11 11
         $params = $request->all();
12
-        if(isset($params['\code'])) {
12
+        if (isset($params['\code'])) {
13 13
             $request->merge([
14 14
                 '\code' => null,
15 15
                 'code' => $params['\code']
16 16
             ]);
17 17
         }
18 18
 
19
-        if(isset($params['\oauth_token'])) {
19
+        if (isset($params['\oauth_token'])) {
20 20
             $request->merge([
21 21
                 '\oauth_token' => null,
22 22
                 'oauth_token' => $params['\oauth_token']
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/InMemory/InMemoryUserRepository.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -18,20 +18,20 @@  discard block
 block discarded – undo
18 18
         $this->users[] = $u;
19 19
     }
20 20
 
21
-    public function getByEmail(string $email):?User
21
+    public function getByEmail(string $email): ?User
22 22
     {
23
-        foreach ($this->users as $user){
24
-            if($user->email() === $email){
23
+        foreach ($this->users as $user) {
24
+            if ($user->email() === $email) {
25 25
                 return $user;
26 26
             }
27 27
         }
28 28
         return null;
29 29
     }
30 30
 
31
-    public function getById(string $id):?User
31
+    public function getById(string $id): ?User
32 32
     {
33
-        foreach ($this->users as $user){
34
-            if($user->id() === $id){
33
+        foreach ($this->users as $user) {
34
+            if ($user->id() === $id) {
35 35
                 return $user;
36 36
             }
37 37
         }
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
     public function search(string $organizationId, int $page, int $perPage = 10): array
42 42
     {
43 43
         $users = [];
44
-        foreach($this->users as $user){
45
-            if($user->organizationId() === $organizationId){
44
+        foreach ($this->users as $user) {
45
+            if ($user->organizationId() === $organizationId) {
46 46
                 $users[] = $user->toDto();
47 47
             }
48 48
         }
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 
57 57
     public function update(User $u)
58 58
     {
59
-        foreach ($this->users as $key => $user){
60
-            if($user->id() === $u->id()){
59
+        foreach ($this->users as $key => $user) {
60
+            if ($user->id() === $u->id()) {
61 61
                 $this->users[$key] = $u;
62 62
             }
63 63
         }
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 
66 66
     public function updateProviders(User $u)
67 67
     {
68
-        foreach ($this->users as $key => $user){
69
-            if($user->id() === $u->id()){
68
+        foreach ($this->users as $key => $user) {
69
+            if ($user->id() === $u->id()) {
70 70
                 $this->users[$key] = $u;
71 71
             }
72 72
         }
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 
75 75
     public function delete(string $userId)
76 76
     {
77
-        foreach ($this->users as $key => $user){
78
-            if($user->id() === $userId){
77
+        foreach ($this->users as $key => $user) {
78
+            if ($user->id() === $userId) {
79 79
                 unset($this->users[$key]);
80 80
             }
81 81
         }
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
     public function getAdminOfOrganization(string $organizationId): array
85 85
     {
86 86
         $users = [];
87
-        foreach ($this->users as $key => $user){
88
-            if($user->organizationId() === $organizationId && $user->isAdmin()){
87
+        foreach ($this->users as $key => $user) {
88
+            if ($user->organizationId() === $organizationId && $user->isAdmin()) {
89 89
                 $users[] = $user;
90 90
             }
91 91
         }
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 
95 95
     public function getByProvider(string $provider, string $providerId): ?User
96 96
     {
97
-        foreach ($this->users as $user){
98
-            if($user->provider($provider, $providerId) === true){
97
+        foreach ($this->users as $user) {
98
+            if ($user->provider($provider, $providerId) === true) {
99 99
                 return $user;
100 100
             }
101 101
         }
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/Auth/SocialiteUser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
         return $this->providerId;
28 28
     }
29 29
 
30
-    public function email():? string
30
+    public function email(): ? string
31 31
     {
32 32
         return $this->email;
33 33
     }
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/Auth/LogUserFromSocialNetwork.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
         $socialiteUser = $this->socialiteGateway->user($provider);
41 41
 
42 42
         $user = $this->userRepository->getByProvider($provider, $socialiteUser->providerId());
43
-        if($user === null){
43
+        if ($user === null) {
44 44
             app(RegisterUserFromSocialNetworkService::class)->register($provider, $socialiteUser);
45 45
             $user = $this->userRepository->getByProvider($provider, $socialiteUser->providerId());
46 46
         }
Please login to merge, or discard this patch.
app/Http/Controllers/Auth/ForgotPasswordController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
         // need to show to the user. Finally, we'll send out a proper response.
39 39
         $response = $this->broker()->sendResetLink(
40 40
             $this->credentials($request),
41
-            function ($user, $token){
41
+            function($user, $token) {
42 42
                 Mail::to($user->email)
43 43
                     ->send(new PasswordResetLink($user, $token));
44 44
             }
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/Users/Dto/GetUserRole.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 {
8 8
     public function get()
9 9
     {
10
-         return collect([
10
+            return collect([
11 11
             new WikiUserRole('advisor'),
12 12
             new WikiUserRole('farmer'),
13 13
             new WikiUserRole('student'),
Please login to merge, or discard this patch.