app/Console/Commands/InitCommand.php
File InitCommand.php
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
<?php
namespace App\Console\Commands;
use App\Console\Commands\Traits\AskForPassword;
Method handle
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function handle(): int
{
$this->alert('KOEL INSTALLATION WIZARD');
$this->info(
'As a reminder, you can always install/upgrade manually following the guide at '
Method setUpDatabase
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function setUpDatabase(): void
{
$config = [
'DB_HOST' => '',
'DB_PORT' => '',
Function maybeSetUpDatabase
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
private function maybeSetUpDatabase(): void
{
$attempt = 0;
while (true) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method maybeSetUpDatabase
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function maybeSetUpDatabase(): void
{
$attempt = 0;
while (true) {
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private MediaCacheService $mediaCacheService,
private Artisan $artisan,
private Hash $hash,
private DotenvEditor $dotenvEditor,
private DB $db,
Function maybeSetMediaPath
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
private function maybeSetMediaPath(): void
{
if (Setting::get('media_path')) {
return;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"