Passed
Push — master ( feee53...6160a4 )
by Innocent
10:45
created
src/Listeners/Ministry/Profile/ImageSaved/ProcessImage.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,11 +36,11 @@
 block discarded – undo
36 36
         $thumb100 = storage_path('app/public/profile/100-100/') . $event->getImage()->name;
37 37
         $thumb50 = storage_path('app/public/profile/50-50/') . $event->getImage()->name;
38 38
 
39
-        $this->imageManager->make($ogImage)->fit(100, 100, function ($constraint) {
39
+        $this->imageManager->make($ogImage)->fit(100, 100, function($constraint) {
40 40
             $constraint->upsize();
41 41
             $constraint->aspectRatio();
42 42
         }, 'center')->save($thumb100);
43
-        $this->imageManager->make($ogImage)->fit(50, 50, function ($constraint) {
43
+        $this->imageManager->make($ogImage)->fit(50, 50, function($constraint) {
44 44
             $constraint->upsize();
45 45
             $constraint->aspectRatio();
46 46
         }, 'center')->save($thumb50);
Please login to merge, or discard this patch.
src/Services/ImageService.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
      */
31 31
     function getUnsetFields()
32 32
     {
33
-        return ['image_id'];
33
+        return [ 'image_id' ];
34 34
     }
35 35
 
36 36
     /**
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,9 +10,11 @@
 block discarded – undo
10 10
     private $image;
11 11
     function __construct(Image $image)
12 12
     {
13
-        if (request()->has('image_id'))
14
-            $this->image = Image::findOrFail(request('image_id'));
15
-        else $this->image = $image;
13
+        if (request()->has('image_id')) {
14
+                    $this->image = Image::findOrFail(request('image_id'));
15
+        } else {
16
+            $this->image = $image;
17
+        }
16 18
     }
17 19
 
18 20
     /**
Please login to merge, or discard this patch.
src/Services/ProfileService.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
      */
29 29
     function getUnsetFields()
30 30
     {
31
-        return ['name', 'email', 'phone'];
31
+        return [ 'name', 'email', 'phone' ];
32 32
     }
33 33
 
34 34
     /**
Please login to merge, or discard this patch.
src/Http/Middleware/SourceSiteMiddleware.php 1 patch
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,8 +15,10 @@
 block discarded – undo
15 15
      */
16 16
     public function handle($request, Closure $next)
17 17
     {
18
-        if (config('faithgen-sdk.source'))
19
-            return $next($request);
20
-        else abort(403, 'You are not allowed to perform this action');
18
+        if (config('faithgen-sdk.source')) {
19
+                    return $next($request);
20
+        } else {
21
+            abort(403, 'You are not allowed to perform this action');
22
+        }
21 23
     }
22 24
 }
Please login to merge, or discard this patch.
src/Http/Middleware/ActivatedMinistryMiddleware.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,9 +15,10 @@
 block discarded – undo
15 15
      */
16 16
     public function handle($request, Closure $next)
17 17
     {
18
-        if (auth(config('faithgen-sdk.guard'))->user()->activation->active)
19
-            return $next($request);
20
-        else
21
-            abort(403, 'You need to activate you account first to access this part');
18
+        if (auth(config('faithgen-sdk.guard'))->user()->activation->active) {
19
+                    return $next($request);
20
+        } else {
21
+                    abort(403, 'You need to activate you account first to access this part');
22
+        }
22 23
     }
23 24
 }
Please login to merge, or discard this patch.
src/Http/Resources/Comment.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,10 +18,11 @@
 block discarded – undo
18 18
      */
19 19
     public function toArray($request)
20 20
     {
21
-        if ($is_admin = Str::of($this->creatable_type)->contains('Ministry'))
22
-            $avatar = ImageHelper::getImage('profile', $this->creatable->image, config('faithgen-sdk.ministries-server'));
23
-        else
24
-            $avatar = ImageHelper::getImage('users', $this->creatable->image, config('faithgen-sdk.users-server'));
21
+        if ($is_admin = Str::of($this->creatable_type)->contains('Ministry')) {
22
+                    $avatar = ImageHelper::getImage('profile', $this->creatable->image, config('faithgen-sdk.ministries-server'));
23
+        } else {
24
+                    $avatar = ImageHelper::getImage('users', $this->creatable->image, config('faithgen-sdk.users-server'));
25
+        }
25 26
 
26 27
         return [
27 28
             'id' => $this->id,
Please login to merge, or discard this patch.
src/Http/Requests/Ministry/UpdateProfileRequest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
             'email' => 'required|email',
30 30
             'phone' => 'required', //todo write a regex to serve,
31 31
             'links' => 'array',
32
-            'color' => 'required|'.Helper::$hexColorRegex,
32
+            'color' => 'required|' . Helper::$hexColorRegex,
33 33
             'location' => 'array',
34 34
             'links.*' => 'url',
35 35
             'statement' => 'array',
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
             'emails.*' => 'email',
40 40
             'services' => 'array',
41 41
             'services.*.day' => 'required|in:' . implode(',', Helper::$weekDays),
42
-            'services.*.start' => ['required', 'date_format:H:i', 'regex:/^((([01]?[0-9]|2[0-3]):[0-5][0-9])?)$/'],
43
-            'services.*.finish' => ['required', 'date_format:H:i', 'regex:/^((([01]?[0-9]|2[0-3]):[0-5][0-9])?)$/'],
42
+            'services.*.start' => [ 'required', 'date_format:H:i', 'regex:/^((([01]?[0-9]|2[0-3]):[0-5][0-9])?)$/' ],
43
+            'services.*.finish' => [ 'required', 'date_format:H:i', 'regex:/^((([01]?[0-9]|2[0-3]):[0-5][0-9])?)$/' ],
44 44
             'services.*.alias' => 'nullable',
45 45
         ];
46 46
     }
Please login to merge, or discard this patch.
src/Http/Requests/Users/SaveRequest.php 1 patch
Braces   +10 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,9 +13,11 @@  discard block
 block discarded – undo
13 13
      */
14 14
     public function authorize()
15 15
     {
16
-        if ($this->route()->getName() === 'users.register')
17
-            return true;
18
-        else return auth('web')->user();
16
+        if ($this->route()->getName() === 'users.register') {
17
+                    return true;
18
+        } else {
19
+            return auth('web')->user();
20
+        }
19 21
     }
20 22
 
21 23
     /**
@@ -37,11 +39,13 @@  discard block
 block discarded – undo
37 39
      */
38 40
     public function rules()
39 41
     {
40
-        if ($this->route()->getName() === 'users.register')
41
-            return $this->baseRules;
42
-        else return array_merge($this->baseRules, [
42
+        if ($this->route()->getName() === 'users.register') {
43
+                    return $this->baseRules;
44
+        } else {
45
+            return array_merge($this->baseRules, [
43 46
             'phone' => 'required|string'
44 47
         ]);
48
+        }
45 49
     }
46 50
 
47 51
     public function messages()
Please login to merge, or discard this patch.
src/Http/Controllers/MinistryController.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     function getSocialLink(GetRequest $request)
57 57
     {
58 58
         return response()->json([
59
-            'link' => auth()->user()->profile[$request->platform]
59
+            'link' => auth()->user()->profile[ $request->platform ]
60 60
         ]);
61 61
     }
62 62
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     function saveSocialLink(UpdateRequest $request)
70 70
     {
71 71
         $profile = auth()->user()->profile;
72
-        $profile[$request->platform] = $request->link;
72
+        $profile[ $request->platform ] = $request->link;
73 73
         try {
74 74
             $profile->save();
75 75
             return response()->json([
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         $fileName = str_shuffle(auth()->user()->id . time() . time()) . '.png';
112 112
         $ogSave = storage_path('app/public/profile/original/') . $fileName;
113 113
         $imageManager->make($request->image)->save($ogSave);
114
-        $image = auth()->user()->image()->updateOrCreate([], [
114
+        $image = auth()->user()->image()->updateOrCreate([ ], [
115 115
             'name' => $fileName
116 116
         ]);
117 117
 
@@ -168,25 +168,25 @@  discard block
 block discarded – undo
168 168
      */
169 169
     function updateProfile(UpdateProfileRequest $request)
170 170
     {
171
-        $ministryParams = $request->only(['name', 'email', 'phone']);
171
+        $ministryParams = $request->only([ 'name', 'email', 'phone' ]);
172 172
 
173 173
         auth()->user()->update($ministryParams);
174 174
 
175
-        $links = ['website', 'facebook', 'youtube', 'twitter', 'instagram'];
176
-        $statements = ['vision', 'mission', 'about_us'];
175
+        $links = [ 'website', 'facebook', 'youtube', 'twitter', 'instagram' ];
176
+        $statements = [ 'vision', 'mission', 'about_us' ];
177 177
 
178
-        $params = ['color' => $request->color];
178
+        $params = [ 'color' => $request->color ];
179 179
 
180 180
         $params = array_merge($params, array_filter($request->links, fn($link) => in_array($link, $links), ARRAY_FILTER_USE_KEY));
181 181
 
182 182
         $params = array_merge($params, array_filter($request->statement, fn($link) => in_array($link, $statements), ARRAY_FILTER_USE_KEY));
183 183
 
184
-        $params = array_merge($params, ['emails' => $request->emails]);
184
+        $params = array_merge($params, [ 'emails' => $request->emails ]);
185 185
 
186
-        $params = array_merge($params, ['phones' => $request->phones]);
186
+        $params = array_merge($params, [ 'phones' => $request->phones ]);
187 187
 
188 188
         if ($request->has('location'))
189
-            $params = array_merge($params, ['location' => $request->location]);
189
+            $params = array_merge($params, [ 'location' => $request->location ]);
190 190
 
191 191
         $this->saveServices($request, auth()->user());
192 192
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
                 ->whereIn('id', $ministry->services()->pluck('id')->toArray())
207 207
                 ->delete();
208 208
 
209
-            $services = array_map(function ($service) {
209
+            $services = array_map(function($service) {
210 210
                 return array_merge($service, [
211 211
                     'id' => str_shuffle((string)Str::uuid()),
212 212
                     'ministry_id' => auth()->user()->id,
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
      */
227 227
     function getLinks($links)
228 228
     {
229
-        $_links = ['website', 'facebook', 'youtube', 'twitter', 'instagram'];
229
+        $_links = [ 'website', 'facebook', 'youtube', 'twitter', 'instagram' ];
230 230
         return array_key_exists($links, $_links);
231 231
     }
232 232
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
             ->ministryUsers()
253 253
             ->latest()
254 254
             //->with(['user.image'])
255
-            ->where(fn($ministryUser) => $ministryUser->whereHas('user', fn($user) => $user->search(['name', 'email'], $request->filter_text)))
255
+            ->where(fn($ministryUser) => $ministryUser->whereHas('user', fn($user) => $user->search([ 'name', 'email' ], $request->filter_text)))
256 256
             ->paginate(Helper::getLimit($request));
257 257
 
258 258
         //return $ministryUsers;
Please login to merge, or discard this patch.
Braces   +20 added lines, -11 removed lines patch added patch discarded remove patch
@@ -90,10 +90,11 @@  discard block
 block discarded – undo
90 90
         ProfileResource::withoutWrapping();
91 91
         MinistryResource::withoutWrapping();
92 92
 
93
-        if (request()->has('complete') && request()->complete)
94
-            return new ProfileResource(auth()->user());
95
-        else
96
-            return new MinistryResource(auth()->user());
93
+        if (request()->has('complete') && request()->complete) {
94
+                    return new ProfileResource(auth()->user());
95
+        } else {
96
+                    return new MinistryResource(auth()->user());
97
+        }
97 98
     }
98 99
 
99 100
     /**
@@ -105,8 +106,9 @@  discard block
 block discarded – undo
105 106
      */
106 107
     function updatePhoto(UpdateImageRequest $request, ImageManager $imageManager)
107 108
     {
108
-        if (auth()->user()->image()->exists())
109
-            $this->deleteFiles(auth()->user());
109
+        if (auth()->user()->image()->exists()) {
110
+                    $this->deleteFiles(auth()->user());
111
+        }
110 112
 
111 113
         $fileName = str_shuffle(auth()->user()->id . time() . time()) . '.png';
112 114
         $ogSave = storage_path('app/public/profile/original/') . $fileName;
@@ -138,8 +140,12 @@  discard block
 block discarded – undo
138 140
                 } catch (\Exception $e) {
139 141
                     abort(500, $e->getMessage());
140 142
                 }
141
-            } else abort(500, 'News passwords did not match!');
142
-        } else abort(500, 'Current password is incorrect!');
143
+            } else {
144
+                abort(500, 'News passwords did not match!');
145
+            }
146
+        } else {
147
+            abort(500, 'Current password is incorrect!');
148
+        }
143 149
     }
144 150
 
145 151
     /**
@@ -157,7 +163,9 @@  discard block
 block discarded – undo
157 163
             } catch (\Exception $e) {
158 164
                 abort(500, $e->getMessage());
159 165
             }
160
-        } else abort(500, 'Password is incorrect!');
166
+        } else {
167
+            abort(500, 'Password is incorrect!');
168
+        }
161 169
     }
162 170
 
163 171
     /**
@@ -185,8 +193,9 @@  discard block
 block discarded – undo
185 193
 
186 194
         $params = array_merge($params, ['phones' => $request->phones]);
187 195
 
188
-        if ($request->has('location'))
189
-            $params = array_merge($params, ['location' => $request->location]);
196
+        if ($request->has('location')) {
197
+                    $params = array_merge($params, ['location' => $request->location]);
198
+        }
190 199
 
191 200
         $this->saveServices($request, auth()->user());
192 201
 
Please login to merge, or discard this patch.