TikiWiki/tiki-manager

View on GitHub

Showing 2,243 of 2,243 total issues

Avoid using static access to class '\TikiManager\Command\Helper\CommandHelper' in method 'execute'.
Open

        $instances = CommandHelper::getInstances();

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\TikiManager\Command\Helper\CommandHelper' in method 'execute'.
Open

            CommandHelper::renderVersionsByFormat($dataOutput, $versionsInfo, $viewFormat);
Severity: Minor
Found in src/Command/TikiVersionCommand.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class '\TikiManager\Command\Helper\CommandHelper' in method 'interact'.
Open

        $instancesInfo = CommandHelper::getInstancesInfo($instances);
Severity: Minor
Found in src/Command/SetupUpdateCommand.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

The method performUpdate() has an NPath complexity of 216. The configured NPath complexity threshold is 200.
Open

    public function performUpdate(Instance $instance, $version = null, $options = [])
    {
        $current = $instance->getLatestVersion();

        if (is_null($version)) {
Severity: Minor
Found in src/Application/Application.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

Avoid using static access to class '\TikiManager\Command\Helper\CommandHelper' in method 'setupInstance'.
Open

        $this->io->info('Instance PHP Version: ' . CommandHelper::formatPhpVersion($instance->phpversion));

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

The method loadEnvironmentVariablesContainingLogic uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $_ENV['INTERACTIVE'] = php_sapi_name() === 'cli'
                && getenv('NONINTERACTIVE') !== 'true'
                && !in_array(getenv('TERM'), ['dumb', false, ''])
                && preg_match(',^/dev/,', exec('tty'));
Severity: Minor
Found in src/Config/Environment.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid unused local variables such as '$db_selected'.
Open

        $db_selected = select_db($mysql_database, $link);
Severity: Minor
Found in scripts/tiki/mysqldump.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

Avoid using static access to class '\TikiManager\Command\Helper\CommandHelper' in method 'execute'.
Open

                CommandHelper::validateInstanceSelection($instancesOption, $instances);
Severity: Minor
Found in src/Command/VerifyInstanceCommand.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

The method setupDatabase() has an NPath complexity of 194641920. The configured NPath complexity threshold is 200.
Open

    public function setupDatabase(Instance $instance, $reconfigure = false): Instance
    {
        try {
            if (!$reconfigure && $this->testExistingDbConnection($instance)) {
                return $instance;

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method changeType uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            return false;
        }
Severity: Minor
Found in src/Access/Access.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method uploadFile uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $host->sendFile($filename, $this->instance->getWebPath($remoteLocation));
        }
Severity: Minor
Found in src/Access/FTP.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method setupDatabase uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $dbPrefix = $this->input->hasOption('db-prefix') ? ($this->input->getOption('db-prefix') ?: 'tiki') : 'tiki';

            $dbPrefix = $this->io->ask(
                'Prefix to use for username and database',

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid using static access to class '\TikiManager\Command\Helper\CommandHelper' in method 'execute'.
Open

        $instances = CommandHelper::getInstances('update');
Severity: Minor
Found in src/Command/WatchInstanceCommand.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

The method uploadFile uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $host->sendFile($filename, $this->instance->getWebPath($remoteLocation));
        }
Severity: Minor
Found in src/Access/Local.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid using static access to class '\TikiManager\Application\Version' in method 'getUpgradeVersion'.
Open

            $default = Version::buildFake($vcs, $branch);

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid using static access to class 'TikiManager\Application\Patch' in method 'restore'.
Open

            foreach (Patch::getPatches($srcInstance->getId()) as $patch) {
Severity: Minor
Found in src/Application/Instance.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

The method localizeFolder uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            if (! file_exists($remoteLocation)) {
                // certain storage folders might not exist, so we have nothing to sync
                return 0;
            } else {
Severity: Minor
Found in src/Access/Local.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method execute() has 182 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $instances = CommandHelper::getInstances('update');
        $instancesInfo = CommandHelper::getInstancesInfo($instances);
        $enableMaintenance = empty($input->getOption('no-maintenance'));
Severity: Minor
Found in src/Command/UpdateInstanceCommand.php by phpmd

The method execute() has 103 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $instances = CommandHelper::getInstances('no-tiki');
        $instancesInfo = CommandHelper::getInstancesInfo($instances);

Avoid using static access to class '\TikiManager\Command\Helper\CommandHelper' in method 'execute'.
Open

        $instancesInfo = CommandHelper::getInstancesInfo($instances);
Severity: Minor
Found in src/Command/RevertInstanceCommand.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Severity
Category
Status
Source
Language