Code cleanup

This commit is contained in:
James Cole
2021-03-21 09:15:40 +01:00
parent da1751940e
commit 206845575c
317 changed files with 7418 additions and 7362 deletions

View File

@@ -44,12 +44,12 @@ class Installer
* Handle an incoming request.
*
* @param Request $request
* @param Closure $next
*
* @throws FireflyException
* @param Closure $next
*
* @return mixed
*
* @throws FireflyException
*
*/
public function handle($request, Closure $next)
{
@@ -81,35 +81,11 @@ class Installer
return $next($request);
}
/**
* Is access denied error.
*
* @param string $message
*
* @return bool
*/
protected function isAccessDenied(string $message): bool
{
return false !== stripos($message, 'Access denied');
}
/**
* Is no tables exist error.
*
* @param string $message
*
* @return bool
*/
protected function noTablesExist(string $message): bool
{
return false !== stripos($message, 'Base table or view not found');
}
/**
* Check if the tables are created and accounted for.
*
* @throws FireflyException
* @return bool
* @throws FireflyException
*/
private function hasNoTables(): bool
{
@@ -136,6 +112,30 @@ class Installer
return false;
}
/**
* Is access denied error.
*
* @param string $message
*
* @return bool
*/
protected function isAccessDenied(string $message): bool
{
return false !== stripos($message, 'Access denied');
}
/**
* Is no tables exist error.
*
* @param string $message
*
* @return bool
*/
protected function noTablesExist(string $message): bool
{
return false !== stripos($message, 'Base table or view not found');
}
/**
* Check if the "db_version" variable is correct.
*
@@ -144,8 +144,8 @@ class Installer
private function oldDBVersion(): bool
{
// older version in config than database?
$configVersion = (int) config('firefly.db_version');
$dbVersion = (int) app('fireflyconfig')->getFresh('db_version', 1)->data;
$configVersion = (int)config('firefly.db_version');
$dbVersion = (int)app('fireflyconfig')->getFresh('db_version', 1)->data;
if ($configVersion > $dbVersion) {
Log::warning(
sprintf(
@@ -170,8 +170,8 @@ class Installer
private function oldVersion(): bool
{
// version compare thing.
$configVersion = (string) config('firefly.version');
$dbVersion = (string) app('fireflyconfig')->getFresh('ff3_version', '1.0')->data;
$configVersion = (string)config('firefly.version');
$dbVersion = (string)app('fireflyconfig')->getFresh('ff3_version', '1.0')->data;
if (1 === version_compare($configVersion, $dbVersion)) {
Log::warning(
sprintf(