Passed
Push — main ( 3097bd...f73fde )
by Julian
04:25
created
app/Providers/AppServiceProvider.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
     public function boot()
28 28
     {
29 29
         Paginator::useBootstrap();
30
-        Validator::extend('isunique', function ($attribute, $value, $parameters, $validator) {
30
+        Validator::extend('isunique', function($attribute, $value, $parameters, $validator) {
31 31
             $value = strtolower($value);
32 32
             $query = DB::table($parameters[0])->whereRaw("LOWER({$attribute}) = ?", [$value]);
33 33
 
Please login to merge, or discard this patch.
app/Providers/RouteServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     {
38 38
         $this->configureRateLimiting();
39 39
 
40
-        $this->routes(function () {
40
+        $this->routes(function() {
41 41
             Route::prefix('api')
42 42
                 ->middleware('api')
43 43
                 ->namespace($this->namespace)
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      */
57 57
     protected function configureRateLimiting()
58 58
     {
59
-        RateLimiter::for('api', function (Request $request) {
59
+        RateLimiter::for ('api', function(Request $request) {
60 60
             return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
61 61
         });
62 62
     }
Please login to merge, or discard this patch.
app/Console/Kernel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      */
35 35
     protected function commands()
36 36
     {
37
-        $this->load(__DIR__.'/Commands');
37
+        $this->load(__DIR__ . '/Commands');
38 38
 
39 39
         require base_path('routes/console.php');
40 40
     }
Please login to merge, or discard this patch.
app/Console/Commands/Translate.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     {
62 62
         for ($c = 0; $c < strlen($b) - 2; $c += 3) {
63 63
             $d = $b[$c + 2];
64
-            $d = $d >= 'a' ? ord($d[0]) - 87 : (int) $d;
64
+            $d = $d >= 'a' ? ord($d[0]) - 87 : (int)$d;
65 65
             $d = $b[$c + 1] === '+' ? $this->unsignedRightShift($a, $d) : $a << $d;
66 66
             $a = $b[$c] === '+' ? ($a + $d & 4294967295) : $a ^ $d;
67 67
         }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     private function unsignedRightShift(int $a, int $b): int
73 73
     {
74 74
         if ($b >= 32 || $b < -32) {
75
-            $m = (int) ($b / 32);
75
+            $m = (int)($b / 32);
76 76
             $b -= ($m * 32);
77 77
         }
78 78
 
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
         }
259 259
 
260 260
         if (is_array($responseArray[0])) {
261
-            return (string) array_reduce($responseArray[0], static function ($carry, $item) {
261
+            return (string)array_reduce($responseArray[0], static function($carry, $item) {
262 262
                 $carry .= $item[0];
263 263
                 return $carry;
264 264
             });
265 265
         }
266 266
 
267
-        return (string) $responseArray[0];
267
+        return (string)$responseArray[0];
268 268
     }
269 269
 
270 270
     public function getResponse(string $string): array
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 
308 308
     protected function isValidLocale(string $lang): bool
309 309
     {
310
-        return (bool) preg_match('/^([a-z]{2,3})(-[A-Za-z]{2,4})?$/', $lang);
310
+        return (bool)preg_match('/^([a-z]{2,3})(-[A-Za-z]{2,4})?$/', $lang);
311 311
     }
312 312
 }
313 313
 
Please login to merge, or discard this patch.
app/Functions/functions.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     // Get image information using getimagesize
53 53
     $imageInfo = getimagesize($file);
54 54
     if (!$imageInfo) {
55
-      return 'dark';
55
+        return 'dark';
56 56
     }
57 57
   
58 58
     // Get the image type
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
   
61 61
     // Load the image based on its type
62 62
     switch ($type) {
63
-      case IMAGETYPE_JPEG:
63
+        case IMAGETYPE_JPEG:
64 64
       case IMAGETYPE_JPEG2000:
65 65
         $img = imagecreatefromjpeg($file);
66 66
         break;
67
-      case IMAGETYPE_PNG:
67
+        case IMAGETYPE_PNG:
68 68
         $img = imagecreatefrompng($file);
69 69
         break;
70
-      default:
70
+        default:
71 71
         return 'dark';
72 72
     }
73 73
   
@@ -78,29 +78,29 @@  discard block
 block discarded – undo
78 78
     // Calculate the average brightness of the image
79 79
     $total_brightness = 0;
80 80
     for ($x=0; $x<$width; $x++) {
81
-      for ($y=0; $y<$height; $y++) {
81
+        for ($y=0; $y<$height; $y++) {
82 82
         $rgb = imagecolorat($img, $x, $y);
83 83
         $r = ($rgb >> 16) & 0xFF;
84 84
         $g = ($rgb >> 8) & 0xFF;
85 85
         $b = $rgb & 0xFF;
86 86
         $brightness = (int)(($r + $g + $b) / 3);
87 87
         $total_brightness += $brightness;
88
-      }
88
+        }
89 89
     }
90 90
     $avg_brightness = $total_brightness / ($width * $height);
91 91
   
92 92
     // Determine if the image is more dark or light
93 93
     if ($avg_brightness < 128) {
94
-      return 'dark';
94
+        return 'dark';
95 95
     } else {
96
-      return 'light';
96
+        return 'light';
97
+    }
98
+        } catch (\Throwable $th) {
99
+            return null;
100
+        }
97 101
     }
98
-      } catch (\Throwable $th) {
99
-          return null;
100
-      }
101
-  }
102 102
   
103
-  function infoIcon($tip) {
103
+    function infoIcon($tip) {
104 104
     echo '
105 105
       <div class="d-flex justify-content-center align-items-center">
106 106
         <a data-bs-toggle="tooltip" data-bs-placement="bottom" title="' . $tip . '">
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         </a>
111 111
       </div>
112 112
     ';
113
-  }
113
+    }
114 114
 
115 115
 function external_file_get_contents($url) {
116 116
     $ch = curl_init();
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
 function analyzeImageBrightness($file) {
49 49
     try {
50
-    $file = base_path('assets/img/background-img/'.$file);
50
+    $file = base_path('assets/img/background-img/' . $file);
51 51
   
52 52
     // Get image information using getimagesize
53 53
     $imageInfo = getimagesize($file);
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
   
78 78
     // Calculate the average brightness of the image
79 79
     $total_brightness = 0;
80
-    for ($x=0; $x<$width; $x++) {
81
-      for ($y=0; $y<$height; $y++) {
80
+    for ($x = 0; $x < $width; $x++) {
81
+      for ($y = 0; $y < $height; $y++) {
82 82
         $rgb = imagecolorat($img, $x, $y);
83 83
         $r = ($rgb >> 16) & 0xFF;
84 84
         $g = ($rgb >> 8) & 0xFF;
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
 function footer($key)
133 133
 {
134 134
     $upperStr = strtoupper($key);
135
-    if (env('TITLE_FOOTER_'.$upperStr) == "") {
136
-        $title = __('messages.footer.'.$key);
135
+    if (env('TITLE_FOOTER_' . $upperStr) == "") {
136
+        $title = __('messages.footer.' . $key);
137 137
     } else {
138
-        $title = env('TITLE_FOOTER_'.$upperStr);
138
+        $title = env('TITLE_FOOTER_' . $upperStr);
139 139
     }
140 140
     return $title;
141 141
 }
142 142
\ No newline at end of file
Please login to merge, or discard this patch.
app/Models/Link.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         parent::boot();
17 17
 
18 18
         static::creating(function ($link) {
19
-          if (config('linkstack.disable_random_link_ids') != 'true') {
19
+            if (config('linkstack.disable_random_link_ids') != 'true') {
20 20
             $numberOfDigits = config('linkstack.link_id_length') ?? 9;
21 21
 
22 22
             $minIdValue = 10**($numberOfDigits - 1);
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
             } while (Link::find($randomId));
28 28
 
29 29
             $link->id = $randomId;
30
-          }
30
+            }
31 31
         });
32 32
     }
33 33
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
     {
16 16
         parent::boot();
17 17
 
18
-        static::creating(function ($link) {
18
+        static::creating(function($link) {
19 19
           if (config('linkstack.disable_random_link_ids') != 'true') {
20 20
             $numberOfDigits = config('linkstack.link_id_length') ?? 9;
21 21
 
Please login to merge, or discard this patch.
app/Models/UserData.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
 
62 62
     private static function getCachedUserData($userId)
63 63
     {
64
-        return Cache::remember('user_data_' . $userId, now()->addMinutes(10), function () use ($userId) {
64
+        return Cache::remember('user_data_' . $userId, now()->addMinutes(10), function() use ($userId) {
65 65
             return self::where('id', $userId)->first();
66 66
         });
67 67
     }
Please login to merge, or discard this patch.
app/Models/User.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
     {
62 62
         parent::boot();
63 63
 
64
-        static::creating(function ($user) {
64
+        static::creating(function($user) {
65 65
             if (config('linkstack.disable_random_user_ids') != 'true') {
66 66
                 if (is_null(User::first())) {
67 67
                     $user->id = 1;
Please login to merge, or discard this patch.
app/Exceptions/Handler.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@
 block discarded – undo
34 34
      */
35 35
     public function register()
36 36
     {
37
-        $this->reportable(function (Throwable $e) {
37
+        $this->reportable(function(Throwable $e) {
38 38
             //
39 39
         });
40 40
 
41
-        $this->renderable(function (\Exception $e) {
41
+        $this->renderable(function(\Exception $e) {
42 42
             if ($e->getPrevious() instanceof \Illuminate\Session\TokenMismatchException) {
43 43
                 return redirect()->route('login');
44 44
             };
Please login to merge, or discard this patch.