for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Turahe\LaravelInstaller\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Http\RedirectResponse;
/**
* Class CanInstall.
*/
class CanInstall
{
* Handle an incoming request.
*
* @param Request $request
* @param Closure $next
* @return mixed|RedirectResponse
public function handle($request, Closure $next): RedirectResponse
if ($this->alreadyInstalled()) {
$installedRedirect = config('installer.installedAlreadyAction');
switch ($installedRedirect) {
case 'route':
$routeName = config('installer.installed.redirectOptions.route.name');
$data = config('installer.installed.redirectOptions.route.message');
return redirect()->route($routeName)->with(['data' => $data]);
break;
break
The break statement is not necessary if it is preceded for example by a return statement:
return
switch ($x) { case 1: return 'foo'; break; // This break is not necessary and can be left off. }
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.
case
case 'abort':
abort(config('installer.installed.redirectOptions.abort.type'));
case 'dump':
$dump = config('installer.installed.redirectOptions.dump.data');
dd($dump);
case '404':
case 'default':
default:
abort(404);
}
return $next($request);
* If application is already installed.
* @return bool
public function alreadyInstalled(): bool
return file_exists(storage_path('installed'));
The
break
statement is not necessary if it is preceded for example by areturn
statement:If you would like to keep this construct to be consistent with other
case
statements, you can safely mark this issue as a false-positive.