Adopt Laravel coding style

Shift automatically applies the Laravel coding style - which uses the PSR-2 coding style as a base with some minor additions.

You may customize the adopted coding style by adding your own [PHP CS Fixer][1] `.php_cs` config file to your project root. Feel free to use [Shift's Laravel ruleset][2] to help you get started.

[1]: https://github.com/FriendsOfPHP/PHP-CS-Fixer
[2]: https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200
This commit is contained in:
Laravel Shift
2021-06-10 20:15:52 +00:00
parent 54cb6c050a
commit 934afa036f
4549 changed files with 35238 additions and 38391 deletions
+23 -26
View File
@@ -96,7 +96,7 @@ class Setting extends Model
*
* @return \App\Models\Setting|null
*/
public static function getSettings(): ?Setting
public static function getSettings(): ?self
{
return Cache::rememberForever(self::APP_SETTINGS_KEY, function () {
// Need for setup as no tables exist
@@ -106,7 +106,7 @@ class Setting extends Model
return null;
}
});
}
}
/**
* Check to see if setup process is complete.
@@ -116,17 +116,16 @@ class Setting extends Model
*/
public static function setupCompleted(): bool
{
try {
$usercount = User::withTrashed()->count();
$settingsCount = self::count();
return $usercount > 0 && $settingsCount > 0;
} catch (\Throwable $th) {
\Log::debug('User table and settings table DO NOT exist or DO NOT have records');
// Catch the error if the tables dont exit
return false;
}
try {
$usercount = User::withTrashed()->count();
$settingsCount = self::count();
return $usercount > 0 && $settingsCount > 0;
} catch (\Throwable $th) {
\Log::debug('User table and settings table DO NOT exist or DO NOT have records');
// Catch the error if the tables dont exit
return false;
}
}
/**
@@ -187,9 +186,9 @@ class Setting extends Model
* Escapes the custom CSS, and then un-escapes the greater-than symbol
* so it can work with direct descendant characters for bootstrap
* menu overrides like:.
*
*
* .skin-blue .sidebar-menu>li.active>a, .skin-blue .sidebar-menu>li:hover>a
*
*
* Important: Do not remove the e() escaping here, as we output raw in the blade.
*
* @return string escaped CSS
@@ -210,14 +209,14 @@ class Setting extends Model
}
/**
* Converts bytes into human readable file size.
*
* @param string $bytes
* Converts bytes into human readable file size.
*
* @return string human readable file size (2,87 Мб)
* @param string $bytes
*
* @author Mogilev Arseny
*/
* @return string human readable file size (2,87 Мб)
*
* @author Mogilev Arseny
*/
public static function fileSizeConvert($bytes): string
{
$bytes = floatval($bytes);
@@ -244,15 +243,15 @@ class Setting extends Model
],
];
foreach ($arBytes as $arItem) {
foreach ($arBytes as $arItem) {
if ($bytes >= $arItem['VALUE']) {
$result = $bytes / $arItem['VALUE'];
$result = round($result, 2).$arItem['UNIT'];
break;
}
break;
}
}
return $result;
return $result;
}
/**
@@ -307,8 +306,6 @@ class Setting extends Model
return 'required|min:'.$settings->pwd_secure_min.$security_rules;
}
/**
* Get the specific LDAP settings
*