Passed
Push — master ( 2b0762...9c76a8 )
by Bertrand
26:13 queued 17:43
created
app/Src/UseCases/Domain/Context/Queries/GetContextByUser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
         $this->contextRepository = $contextRepository;
17 17
     }
18 18
 
19
-    public function execute(string $userId):?ContextDto
19
+    public function execute(string $userId): ?ContextDto
20 20
     {
21 21
         return $this->contextRepository->getByUserDto($userId);
22 22
     }
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/Shared/Model/Dto.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@
 block discarded – undo
13 13
 
14 14
     private function serialize(array $properties)
15 15
     {
16
-        foreach ($properties as $key => $property){
17
-            if(is_object($property)){
16
+        foreach ($properties as $key => $property) {
17
+            if (is_object($property)) {
18 18
                 $params[$this->camelToSnake($key)] = $this->serialize(get_object_vars($property));
19
-            }else {
19
+            } else {
20 20
                 $params[$this->camelToSnake($key)] = $property;
21 21
             }
22 22
         }
Please login to merge, or discard this patch.
app/Http/Controllers/Profile/ProfileController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $allCharacteristics = app(GetAllCharacteristics::class)->get();
35 35
         try {
36 36
             $context = $contextQueryByUser->execute(Auth::user()->uuid)->toArray();
37
-        }catch (\Throwable $e){
37
+        } catch (\Throwable $e) {
38 38
             Log::emergency($e->getMessage().' '.$e->getLine().' '.$e->getFile().' '.$e->getTraceAsString());
39 39
             return redirect()->route('wizard.profile');
40 40
         }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         $roles = app(GetUserRole::class)->get()->toArray();
44 44
         $practises = app(GetUserPractises::class)->get(Auth::user()->uuid);
45 45
         $interactions = app(GetInteractionsByUser::class)->get(Auth::user()->uuid);
46
-        $usersCharacteristics =  array_merge($context['productions'], $context['characteristics'], $context['characteristics_departement']);
46
+        $usersCharacteristics = array_merge($context['productions'], $context['characteristics'], $context['characteristics_departement']);
47 47
         $uuidsUserCharacteristics = array_column($usersCharacteristics, 'uuid');
48 48
         $role = last($user['roles']);
49 49
         $routeComment = route('profile.comments.show');
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
         $roles = app(GetUserRole::class)->get()->toArray();
73 73
         $practises = app(GetUserPractises::class)->get($userId);
74 74
         $interactions = app(GetInteractionsByUser::class)->get($userId);
75
-        $usersCharacteristics =  array_merge($context['productions'], $context['characteristics']);
75
+        $usersCharacteristics = array_merge($context['productions'], $context['characteristics']);
76 76
         $uuidsUserCharacteristics = array_column($usersCharacteristics, 'uuid');
77 77
         $role = last($user['roles']);
78 78
 
Please login to merge, or discard this patch.
app/Src/UseCases/Infra/Sql/ReportingCharacteristicSql.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
             ->selectRaw('count(*) AS count, contexts.department_number as department_number')
16 16
             ->join('users', 'users.id', 'interactions.user_id')
17 17
             ->join('contexts', 'users.context_id', 'contexts.id')
18
-            ->where(function ($query) use ($type){
19
-                $query->when($type === 'follow', function ($query) {
18
+            ->where(function($query) use ($type){
19
+                $query->when($type === 'follow', function($query) {
20 20
                     $query->where('follow', true);
21 21
                     $query->orWhere('done', true);
22 22
                 })
23
-                ->when($type === 'do', function ($query) {
23
+                ->when($type === 'do', function($query) {
24 24
                     $query->where('done', true);
25 25
                 });
26 26
             })
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
             ->get();
31 31
 
32 32
         $interactionsToReturn = [];
33
-        foreach($interactions as $interaction){
33
+        foreach ($interactions as $interaction) {
34 34
             $characteristicsModel = CharacteristicsModel::query()->where('code', $interaction->department_number)->first();
35
-            if(!isset($characteristicsModel)){
35
+            if (!isset($characteristicsModel)) {
36 36
                 continue;
37 37
             }
38 38
             $characteristicsModel->icon = route('api.icon.serve', ['id' => $characteristicsModel->uuid]);
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
             ->join('contexts', 'users.context_id', 'contexts.id')
54 54
             ->join('user_characteristics', 'user_characteristics.user_id', 'users.id')
55 55
             ->join('characteristics', 'characteristics.id', 'user_characteristics.characteristic_id')
56
-            ->where(function ($query) use ($type){
57
-                $query->when($type === 'follow', function ($query) {
56
+            ->where(function($query) use ($type){
57
+                $query->when($type === 'follow', function($query) {
58 58
                     $query->where('follow', true);
59 59
                     $query->orWhere('done', true);
60 60
                 })
61
-                ->when($type === 'do', function ($query) {
61
+                ->when($type === 'do', function($query) {
62 62
                     $query->where('done', true);
63 63
                 });
64 64
             })
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             ->get();
72 72
 
73 73
         $characteristicsToReturn = [];
74
-        foreach($characteristicsCount as $characteristicCount){
74
+        foreach ($characteristicsCount as $characteristicCount) {
75 75
             $characteristic = CharacteristicsModel::query()->find($characteristicCount->characteristic_id);
76 76
             $characteristic->count = $characteristicCount->count;
77 77
             $c = $characteristic->toArray();
Please login to merge, or discard this patch.
app/Src/UseCases/Domain/Context/Queries/SearchStructure.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@
 block discarded – undo
17 17
         $uri = config('wiki.api_uri').'?action=query&list=search&srwhat=text&srsearch='.$search.'&srqiprofile=classic_noboostlinks&srnamespace=3000&format=json';
18 18
         try {
19 19
             $response = $client->get($uri);
20
-        }catch (\Throwable $e){
20
+        } catch (\Throwable $e) {
21 21
             return ['results' => []];
22 22
         }
23 23
         $content = json_decode($response->getBody()->getContents(), true);
24
-        if(isset($content['query']['search'])){
24
+        if (isset($content['query']['search'])) {
25 25
             $results = array_column($content['query']['search'], 'title');
26
-            return array_map(function ($item){
26
+            return array_map(function($item) {
27 27
                 return str_replace('Structure:', '', $item);
28 28
             }, $results);
29 29
         }
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/Src/UseCases/Infra/Sql/UserRepositorySql.php 1 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/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.