Code cleanup that (hopefully) matches style CI

This commit is contained in:
James Cole
2020-03-17 15:01:00 +01:00
parent bd2f064eeb
commit 2b6c3fd743
110 changed files with 2060 additions and 1660 deletions

View File

@@ -27,8 +27,13 @@ use FireflyIII\Helpers\Update\UpdateTrait;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Middleware\IsDemoUser;
use FireflyIII\Http\Middleware\IsSandStormUser;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\View\View;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/**
* Class HomeController.
@@ -45,7 +50,7 @@ class UpdateController extends Controller
parent::__construct();
$this->middleware(
static function ($request, $next) {
app('view')->share('title', (string)trans('firefly.administration'));
app('view')->share('title', (string) trans('firefly.administration'));
app('view')->share('mainTitleIcon', 'fa-hand-spock-o');
return $next($request);
@@ -58,28 +63,28 @@ class UpdateController extends Controller
/**
* Show page with update options.
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @throws \Psr\Container\NotFoundExceptionInterface
* @throws \Psr\Container\ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @throws ContainerExceptionInterface
* @return Factory|View
*/
public function index()
{
$subTitle = (string)trans('firefly.update_check_title');
$subTitle = (string) trans('firefly.update_check_title');
$subTitleIcon = 'fa-star';
$permission = app('fireflyconfig')->get('permission_update_check', -1);
$channel = app('fireflyconfig')->get('update_channel', 'stable');
$selected = $permission->data;
$channelSelected = $channel->data;
$options = [
-1 => (string)trans('firefly.updates_ask_me_later'),
0 => (string)trans('firefly.updates_do_not_check'),
1 => (string)trans('firefly.updates_enable_check'),
-1 => (string) trans('firefly.updates_ask_me_later'),
0 => (string) trans('firefly.updates_do_not_check'),
1 => (string) trans('firefly.updates_enable_check'),
];
$channelOptions = [
'stable' => (string)trans('firefly.update_channel_stable'),
'beta' => (string)trans('firefly.update_channel_beta'),
'alpha' => (string)trans('firefly.update_channel_alpha'),
'stable' => (string) trans('firefly.update_channel_stable'),
'beta' => (string) trans('firefly.update_channel_beta'),
'alpha' => (string) trans('firefly.update_channel_alpha'),
];
return view('admin.update.index', compact('subTitle', 'subTitleIcon', 'selected', 'options', 'channelSelected', 'channelOptions'));
@@ -90,17 +95,17 @@ class UpdateController extends Controller
*
* @param Request $request
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @return RedirectResponse|Redirector
*/
public function post(Request $request)
{
$checkForUpdates = (int)$request->get('check_for_updates');
$checkForUpdates = (int) $request->get('check_for_updates');
$channel = $request->get('update_channel');
$channel = in_array($channel, ['stable', 'beta', 'alpha'], true) ? $channel : 'stable';
app('fireflyconfig')->set('permission_update_check', $checkForUpdates);
app('fireflyconfig')->set('last_update_check', time());
app('fireflyconfig')->set('update_channel', $channel);
session()->flash('success', (string)trans('firefly.configuration_updated'));
session()->flash('success', (string) trans('firefly.configuration_updated'));
return redirect(route('admin.update-check'));
}
@@ -110,7 +115,7 @@ class UpdateController extends Controller
*/
public function updateCheck(): RedirectResponse
{
$release = $this->getLatestRelease();
$release = $this->getLatestRelease();
session()->flash($release['level'], $release['message']);