Passed
Push — main ( fa2223...9ae1c5 )
by PRATIK
09:59 queued 05:52
created
src/Helpers/AdminHelper.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -2,14 +2,14 @@  discard block
 block discarded – undo
2 2
 
3 3
 use Pratiksh\Adminetic\Models\Admin\Setting;
4 4
 
5
-if (! function_exists('spa')) {
5
+if (!function_exists('spa')) {
6 6
     function spa()
7 7
     {
8 8
         return setting('spa', config('adminetic.spa', true));
9 9
     }
10 10
 }
11 11
 
12
-if (! function_exists('getClassesList')) {
12
+if (!function_exists('getClassesList')) {
13 13
     function getClassesList($dir)
14 14
     {
15 15
         $classes = \File::allFiles($dir);
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         return $classes;
25 25
     }
26 26
 }
27
-if (! function_exists('getAllModelNames')) {
27
+if (!function_exists('getAllModelNames')) {
28 28
     function getAllModelNames($dir)
29 29
     {
30 30
         $modelNames = [];
@@ -38,42 +38,42 @@  discard block
 block discarded – undo
38 38
     }
39 39
 }
40 40
 
41
-if (! function_exists('validImageFolder')) {
41
+if (!function_exists('validImageFolder')) {
42 42
     function validImageFolder($name, $default = 'default')
43 43
     {
44 44
         return strtolower(str_replace([' ', '-', '$', '<', '>', '&', '{', $closing_token, '*', '\\', '/', ':', '.', ';', ',', "'", '"'], '_', $name ?? trim($default)));
45 45
     }
46 46
 }
47 47
 
48
-if (! function_exists('getImagePlaceholder')) {
48
+if (!function_exists('getImagePlaceholder')) {
49 49
     function getImagePlaceholder()
50 50
     {
51 51
         return asset('adminetic/static/placeholder.png');
52 52
     }
53 53
 }
54 54
 
55
-if (! function_exists('getVerticalImagePlaceholder')) {
55
+if (!function_exists('getVerticalImagePlaceholder')) {
56 56
     function getVerticalImagePlaceholder()
57 57
     {
58 58
         return asset('adminetic/static/vertical_placeholder.jpg');
59 59
     }
60 60
 }
61 61
 
62
-if (! function_exists('getSliderPlaceholder')) {
62
+if (!function_exists('getSliderPlaceholder')) {
63 63
     function getSliderPlaceholder()
64 64
     {
65 65
         return asset('adminetic/static/slider.jpg');
66 66
     }
67 67
 }
68 68
 
69
-if (! function_exists('getFoodImagePlaceholder')) {
69
+if (!function_exists('getFoodImagePlaceholder')) {
70 70
     function getFoodImagePlaceholder()
71 71
     {
72 72
         return asset('adminetic/static/food_placeholder.jpg');
73 73
     }
74 74
 }
75 75
 
76
-if (! function_exists('getProfilePlaceholder')) {
76
+if (!function_exists('getProfilePlaceholder')) {
77 77
     function getProfilePlaceholder($p = null)
78 78
     {
79 79
         $profile = $p ?? Auth::user()->profile ?? Auth::user()->profile()->create();
@@ -82,91 +82,91 @@  discard block
 block discarded – undo
82 82
     }
83 83
 }
84 84
 
85
-if (! function_exists('title')) {
85
+if (!function_exists('title')) {
86 86
     function title()
87 87
     {
88 88
         return setting('title', config('adminetic.name', 'Adminetic'));
89 89
     }
90 90
 }
91 91
 
92
-if (! function_exists('description')) {
92
+if (!function_exists('description')) {
93 93
     function description($default = null)
94 94
     {
95 95
         return setting('description', config('adminetic.description', $default ?? 'Adminetic Admin Panel'));
96 96
     }
97 97
 }
98 98
 
99
-if (! function_exists('keywords')) {
99
+if (!function_exists('keywords')) {
100 100
     function keywords()
101 101
     {
102 102
         return setting('keywords', config('adminetic.keywords', 'adminetic admin panel, adminetic, pratik shrestha, doctype innovations'));
103 103
     }
104 104
 }
105 105
 
106
-if (! function_exists('loader_enabled')) {
106
+if (!function_exists('loader_enabled')) {
107 107
     function loader_enabled()
108 108
     {
109 109
         return setting('loader_enabled', config('adminetic.loader_enabled', true));
110 110
     }
111 111
 }
112 112
 
113
-if (! function_exists('favicon')) {
113
+if (!function_exists('favicon')) {
114 114
     function favicon()
115 115
     {
116
-        return getImg(! is_null(setting('favicon')) ? setting('favicon') : 'adminetic/static/favicon.png', 'adminetic/static/favicon.png');
116
+        return getImg(!is_null(setting('favicon')) ? setting('favicon') : 'adminetic/static/favicon.png', 'adminetic/static/favicon.png');
117 117
     }
118 118
 }
119 119
 
120
-if (! function_exists('logo')) {
120
+if (!function_exists('logo')) {
121 121
     function logo()
122 122
     {
123
-        return getImg(! is_null(setting('logo')) ? setting('logo') : 'adminetic/static/logo.png', 'adminetic/static/logo.png');
123
+        return getImg(!is_null(setting('logo')) ? setting('logo') : 'adminetic/static/logo.png', 'adminetic/static/logo.png');
124 124
     }
125 125
 }
126 126
 
127
-if (! function_exists('dark_logo')) {
127
+if (!function_exists('dark_logo')) {
128 128
     function dark_logo()
129 129
     {
130
-        return getImg(! is_null(setting('dark_logo')) ? setting('dark_logo') : 'adminetic/static/dark_logo.png', 'adminetic/static/dark_logo.png');
130
+        return getImg(!is_null(setting('dark_logo')) ? setting('dark_logo') : 'adminetic/static/dark_logo.png', 'adminetic/static/dark_logo.png');
131 131
     }
132 132
 }
133 133
 
134
-if (! function_exists('logoBanner')) {
134
+if (!function_exists('logoBanner')) {
135 135
     function logoBanner()
136 136
     {
137
-        return getImg(! is_null(setting('logo_banner')) ? setting('logo_banner') : 'adminetic/static/logo_banner.png', 'adminetic/static/logo_banner.png');
137
+        return getImg(!is_null(setting('logo_banner')) ? setting('logo_banner') : 'adminetic/static/logo_banner.png', 'adminetic/static/logo_banner.png');
138 138
     }
139 139
 }
140 140
 
141
-if (! function_exists('login_register_bg_image')) {
141
+if (!function_exists('login_register_bg_image')) {
142 142
     function login_register_bg_image()
143 143
     {
144
-        return getImg(! is_null(setting('login_register_bg_image')) ? setting('login_register_bg_image') : 'adminetic/static/login_register_bg_img.jpg', 'adminetic/static/login_register_bg_img.jpg');
144
+        return getImg(!is_null(setting('login_register_bg_image')) ? setting('login_register_bg_image') : 'adminetic/static/login_register_bg_img.jpg', 'adminetic/static/login_register_bg_img.jpg');
145 145
     }
146 146
 }
147 147
 
148
-if (! function_exists('getLazyLoadImg')) {
148
+if (!function_exists('getLazyLoadImg')) {
149 149
     function getLazyLoadImg()
150 150
     {
151 151
         return asset('adminetic/static/loader.svg');
152 152
     }
153 153
 }
154 154
 
155
-if (! function_exists('random_color_part')) {
155
+if (!function_exists('random_color_part')) {
156 156
     function random_color_part()
157 157
     {
158 158
         return str_pad(dechex(mt_rand(0, 255)), 2, '0', STR_PAD_LEFT);
159 159
     }
160 160
 }
161 161
 
162
-if (! function_exists('random_color')) {
162
+if (!function_exists('random_color')) {
163 163
     function random_color()
164 164
     {
165 165
         return random_color_part().random_color_part().random_color_part();
166 166
     }
167 167
 }
168 168
 
169
-if (! function_exists('setting')) {
169
+if (!function_exists('setting')) {
170 170
     function setting($setting_name, $default = null)
171 171
     {
172 172
         $valid_setting_name = strtolower(str_replace(' ', '_', $setting_name));
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     }
177 177
 }
178 178
 
179
-if (! function_exists('preference')) {
179
+if (!function_exists('preference')) {
180 180
     function preference($preference_name, bool $default = null)
181 181
     {
182 182
         $valid_preference_name = strtolower(str_replace(' ', '_', $preference_name));
@@ -190,39 +190,39 @@  discard block
 block discarded – undo
190 190
     }
191 191
 }
192 192
 
193
-if (! function_exists('deleteImage')) {
193
+if (!function_exists('deleteImage')) {
194 194
     function deleteImage($image)
195 195
     {
196 196
         $image ? (\Illuminate\Support\Facades\File::exists(public_path('storage/'.$image)) ? \Illuminate\Support\Facades\File::delete(public_path('storage/'.$image)) : '') : '';
197 197
     }
198 198
 }
199 199
 
200
-if (! function_exists('api_paginate_limit')) {
200
+if (!function_exists('api_paginate_limit')) {
201 201
     function api_paginate_limit($default = null)
202 202
     {
203 203
         return setting('api_paginate_limit', $default ?? config('adminetic.api_paginate_limit', 10));
204 204
     }
205 205
 }
206 206
 
207
-if (! function_exists('api_collection_return_paginate')) {
207
+if (!function_exists('api_collection_return_paginate')) {
208 208
     function api_collection_return_paginate()
209 209
     {
210 210
         return setting('api_collection_return_paginate', config('adminetic.api_collection_return_paginate', true));
211 211
     }
212 212
 }
213 213
 
214
-if (! function_exists('darkMode')) {
214
+if (!function_exists('darkMode')) {
215 215
     function darkMode()
216 216
     {
217 217
         return setting('dark_mode', config('adminetic.dark_mode', false));
218 218
     }
219 219
 }
220 220
 
221
-if (! function_exists('getCondition')) {
221
+if (!function_exists('getCondition')) {
222 222
     function getCondition($conditions)
223 223
     {
224 224
         $result = null;
225
-        if (! isset($conditions)) {
225
+        if (!isset($conditions)) {
226 226
             return false;
227 227
         }
228 228
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
     }
249 249
 }
250 250
 
251
-if (! function_exists('getImg')) {
251
+if (!function_exists('getImg')) {
252 252
     function getImg($img, $default)
253 253
     {
254 254
         if (isset($img)) {
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     }
266 266
 }
267 267
 
268
-if (! function_exists('putContentToClassFunction')) {
268
+if (!function_exists('putContentToClassFunction')) {
269 269
     function putContentToClassFunction($file, $function_name, $data, $closing_token = '}')
270 270
     {
271 271
         $data = $data."\n";
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
     }
301 301
 }
302 302
 
303
-if (! function_exists('setEnvValue')) {
303
+if (!function_exists('setEnvValue')) {
304 304
     function setEnvValue(array $values)
305 305
     {
306 306
         $envFile = app()->environmentFilePath();
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
                 $oldLine = substr($str, $keyPosition, $endOfLinePosition - $keyPosition);
315 315
 
316 316
                 // If key does not exist, add it
317
-                if (! $keyPosition || ! $endOfLinePosition || ! $oldLine) {
317
+                if (!$keyPosition || !$endOfLinePosition || !$oldLine) {
318 318
                     $str .= "{$envKey}={$envValue}\n";
319 319
                 } else {
320 320
                     $str = str_replace($oldLine, "{$envKey}={$envValue}", $str);
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
         }
324 324
 
325 325
         $str = substr($str, 0, -1);
326
-        if (! file_put_contents($envFile, $str)) {
326
+        if (!file_put_contents($envFile, $str)) {
327 327
             return false;
328 328
         }
329 329
 
Please login to merge, or discard this patch.