Passed
Push — master ( feee53...6160a4 )
by Innocent
10:45
created
src/Mixins/DatabaseBuilder.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,11 +16,13 @@  discard block
 block discarded – undo
16 16
     {
17 17
         return function ($attributes, ?string $filter_text) {
18 18
 
19
-            if ($filter_text)
20
-                $filter_text = '%' . $filter_text . '%';
19
+            if ($filter_text) {
20
+                            $filter_text = '%' . $filter_text . '%';
21
+            }
21 22
 
22
-            if (is_string($attributes))
23
-                return $this->where($attributes, 'LIKE', $filter_text);
23
+            if (is_string($attributes)) {
24
+                            return $this->where($attributes, 'LIKE', $filter_text);
25
+            }
24 26
 
25 27
             if (is_array($attributes)) {
26 28
                 $attributes = collect($attributes);
@@ -31,11 +33,11 @@  discard block
 block discarded – undo
31 33
 
32 34
                 $query = $this->where($attribute, 'LIKE', $filter_text);
33 35
 
34
-                if (sizeof($remainderKeys))
35
-                    foreach ($remainderKeys as $key) {
36
+                if (sizeof($remainderKeys)) {
37
+                                    foreach ($remainderKeys as $key) {
36 38
                         if (!Str::of($key)->contains('.'))
37 39
                             $query->orWhere($key, 'LIKE', $filter_text);
38
-                        else {
40
+                } else {
39 41
                             [$relationship, $column] = explode('.', $key);
40 42
 
41 43
                             // $eloquentBuilder->orWhereHas($relationship, fn($model) => $model->where($column, 'LIKE', $filter_text));
@@ -44,7 +46,9 @@  discard block
 block discarded – undo
44 46
 
45 47
                 return $query;
46 48
 
47
-            } else abort(402, 'Invalid search fields');
49
+            } else {
50
+                abort(402, 'Invalid search fields');
51
+            }
48 52
         };
49 53
     }
50 54
 }
Please login to merge, or discard this patch.
src/Helpers/ImageHelper.php 1 patch
Braces   +11 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,9 +18,11 @@  discard block
 block discarded – undo
18 18
      */
19 19
     private static function getImages(string $server, string $folder, ?Image $image): object
20 20
     {
21
-        if ($image)
22
-            $imageName = $image->name;
23
-        else return static::getDefaultImage();
21
+        if ($image) {
22
+                    $imageName = $image->name;
23
+        } else {
24
+            return static::getDefaultImage();
25
+        }
24 26
 
25 27
         return (object)[
26 28
             '_50' => $server . '/storage/' . $folder . '/50-50/' . $imageName,
@@ -38,8 +40,9 @@  discard block
 block discarded – undo
38 40
     {
39 41
         $protocol = 'http://';
40 42
 
41
-        if (Str::of(URL::current())->startsWith('https'))
42
-            $protocol = 'https://';
43
+        if (Str::of(URL::current())->startsWith('https')) {
44
+                    $protocol = 'https://';
45
+        }
43 46
 
44 47
         return (object)[
45 48
             '_50' => $protocol . $_SERVER['HTTP_HOST'] . '/images/logo-50.png',
@@ -58,8 +61,9 @@  discard block
 block discarded – undo
58 61
      */
59 62
     public static function getImage(string $folder, ?Image $image, ?string $server = null)
60 63
     {
61
-        if (!$server)
62
-            $server = config('faithgen-sdk.ministries-server');
64
+        if (!$server) {
65
+                    $server = config('faithgen-sdk.ministries-server');
66
+        }
63 67
 
64 68
         return static::getImages($server, $folder, $image);
65 69
     }
Please login to merge, or discard this patch.
src/Helpers/CommentHelper.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,9 @@
 block discarded – undo
27 27
                         'creatable_id'   => auth('web')->user()->id,
28 28
                         'creatable_type' => get_class(auth('web')->user()),
29 29
                     ]);
30
-                } else abort(403, 'You are not permitted to comment on this');
30
+                } else {
31
+                    abort(403, 'You are not permitted to comment on this');
32
+                }
31 33
             } else {
32 34
                 $comment = $model->comments()->create([
33 35
                     'comment'        => $request->comment,
Please login to merge, or discard this patch.
src/Traits/ConfigTrait.php 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,12 +31,13 @@  discard block
 block discarded – undo
31 31
 
32 32
     private function loadRoutes($routes)
33 33
     {
34
-        if ($routes)
35
-            if (is_string($routes))
34
+        if ($routes) {
35
+                    if (is_string($routes))
36 36
                 $this->loadRoutesFrom($routes);
37
-            else if (is_array($routes))
38
-                foreach ($routes as $route) {
37
+        } else if (is_array($routes)) {
38
+                            foreach ($routes as $route) {
39 39
                     $this->loadRoutesFrom($route);
40
+            }
40 41
                 }
41 42
     }
42 43
 
@@ -45,8 +46,9 @@  discard block
 block discarded – undo
45 46
      */
46 47
     protected function setUpSourceFiles(\Closure $closure)
47 48
     {
48
-        if ($this->app->runningInConsole())
49
-            if (config('faithgen-sdk.source'))
49
+        if ($this->app->runningInConsole()) {
50
+                    if (config('faithgen-sdk.source'))
50 51
                 $closure->call($this);
52
+        }
51 53
     }
52 54
 }
Please login to merge, or discard this patch.
src/Traits/FileTraits.php 1 patch
Braces   +13 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,10 +14,11 @@  discard block
 block discarded – undo
14 14
 
15 15
     function getImage(string $dir, string $imageName, int $dimen = 0)
16 16
     {
17
-        if ($dimen)
18
-            $dimen = $dimen . '-' . $dimen . '/';
19
-        else
20
-            $dimen = 'original/';
17
+        if ($dimen) {
18
+                    $dimen = $dimen . '-' . $dimen . '/';
19
+        } else {
20
+                    $dimen = 'original/';
21
+        }
21 22
         return storage_path('app/public/' . $dir . '/' . $dimen . $imageName);
22 23
     }
23 24
 
@@ -34,13 +35,15 @@  discard block
 block discarded – undo
34 35
     {
35 36
         $images = [];
36 37
         foreach ($model->getImageDimensions() as $imageDimension) {
37
-            if (is_string($model->getFileName()))
38
-                array_push($images, $this->getImage($model->filesDir(), $model->getFileName(), $imageDimension));
39
-            else if (is_array($model->getFileName()))
40
-                foreach ($model->getFileName() as $filename) {
38
+            if (is_string($model->getFileName())) {
39
+                            array_push($images, $this->getImage($model->filesDir(), $model->getFileName(), $imageDimension));
40
+            } else if (is_array($model->getFileName())) {
41
+                            foreach ($model->getFileName() as $filename) {
41 42
                     array_push($images, $this->getImage($model->filesDir(), $filename, $imageDimension));
42
-                }
43
-            else throw new \InvalidArgumentException('The file name is invalid, string or array required', 500);
43
+            }
44
+                } else {
45
+                throw new \InvalidArgumentException('The file name is invalid, string or array required', 500);
46
+            }
44 47
         }
45 48
         try {
46 49
             foreach ($images as $file) {
Please login to merge, or discard this patch.
src/Models/User.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,8 +57,9 @@
 block discarded – undo
57 57
 
58 58
     public function getActiveAttribute(): bool
59 59
     {
60
-        if ($user = $this->ministryUsers()->where('ministry_id', auth()->user()->id)->first())
61
-            return (bool)$user->active;
60
+        if ($user = $this->ministryUsers()->where('ministry_id', auth()->user()->id)->first()) {
61
+                    return (bool)$user->active;
62
+        }
62 63
         return false;
63 64
     }
64 65
 
Please login to merge, or discard this patch.
src/Models/Ministry.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -104,7 +104,9 @@  discard block
 block discarded – undo
104 104
             $phones = $this->profile->phones;
105 105
             array_unshift($phones, $this->phone);
106 106
             return $phones;
107
-        } else return [$this->phone];
107
+        } else {
108
+            return [$this->phone];
109
+        }
108 110
     }
109 111
 
110 112
     function getEmailsAttribute()
@@ -113,7 +115,9 @@  discard block
 block discarded – undo
113 115
             $emails = $this->profile->emails;
114 116
             array_unshift($emails, $this->email);
115 117
             return $emails;
116
-        } else return [$this->email];
118
+        } else {
119
+            return [$this->email];
120
+        }
117 121
     }
118 122
 
119 123
     /**
Please login to merge, or discard this patch.
src/Observers/MinistryObserver.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,8 +60,9 @@
 block discarded – undo
60 60
     public function deleted(Ministry $ministry)
61 61
     {
62 62
         //todo remove aa lotta staff related to this ministry
63
-        if ($ministry->image()->exists())
64
-            $ministry->image()->delete();
63
+        if ($ministry->image()->exists()) {
64
+                    $ministry->image()->delete();
65
+        }
65 66
 
66 67
         try {
67 68
             $this->deleteFiles($ministry);
Please login to merge, or discard this patch.
src/Observers/UserObserver.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,11 +30,12 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function created(User $user)
32 32
     {
33
-        if (request()->has('image'))
34
-            UploadImage::withChain([
33
+        if (request()->has('image')) {
34
+                    UploadImage::withChain([
35 35
                 new ProcessImage($user),
36 36
                 new S3Upload($user)
37 37
             ])->dispatch($user, request('image'));
38
+        }
38 39
     }
39 40
 
40 41
     /**
@@ -62,8 +63,9 @@  discard block
 block discarded – undo
62 63
      */
63 64
     public function deleted(User $user)
64 65
     {
65
-        if ($user->image()->exists())
66
-            $this->deleteFiles($user);
66
+        if ($user->image()->exists()) {
67
+                    $this->deleteFiles($user);
68
+        }
67 69
     }
68 70
 
69 71
     /**
Please login to merge, or discard this patch.