TikiWiki/tiki-manager

View on GitHub
src/Command/ClearCacheCommand.php

Summary

Maintainability
A
0 mins
Test Coverage

execute accesses the super-global variable $_ENV.
Open

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $cachePath = $_ENV['CACHE_FOLDER'];
        $logger = new ConsoleLogger($output);
        $result = CommandHelper::clearFolderContents($cachePath, $logger);
Severity: Minor
Found in src/Command/ClearCacheCommand.php by phpmd

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

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

        $result = CommandHelper::clearFolderContents($cachePath, $logger);
Severity: Minor
Found in src/Command/ClearCacheCommand.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

Argument 2 (logger) is \Symfony\Component\Console\Logger\ConsoleLogger but \TikiManager\Command\Helper\CommandHelper::clearFolderContents() takes \Psr\Log\LoggerInterface defined at /code/src/Command/Helper/CommandHelper.php:370
Open

        $result = CommandHelper::clearFolderContents($cachePath, $logger);
Severity: Minor
Found in src/Command/ClearCacheCommand.php by phan

There are no issues that match your filters.

Category
Status