TikiWiki/tiki-manager

View on GitHub
src/Command/SetupUpdateCommand.php

Summary

Maintainability
A
1 hr
Test Coverage

execute accesses the super-global variable $_ENV.
Open

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $time = $input->getOption('time');
        // Check if option (set in cli is also valid)
        list($hours, $minutes) = CommandHelper::validateTimeInput($time);
Severity: Minor
Found in src/Command/SetupUpdateCommand.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

execute accesses the super-global variable $_ENV.
Open

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $time = $input->getOption('time');
        // Check if option (set in cli is also valid)
        list($hours, $minutes) = CommandHelper::validateTimeInput($time);
Severity: Minor
Found in src/Command/SetupUpdateCommand.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

Method interact has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function interact(InputInterface $input, OutputInterface $output)
    {
        if (empty($input->getOption('time'))) {
            $answer = $this->io->ask('What time should it run at?', '00:00', function ($answer) {
                return CommandHelper::validateTimeInput($answer);
Severity: Minor
Found in src/Command/SetupUpdateCommand.php - About 1 hr to fix

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

                CommandHelper::renderInstancesTable($output, $instancesInfo);
    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

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

            list($hours, $minutes) = CommandHelper::validateTimeInput($time);
    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

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

                    return CommandHelper::validateTimeInput($answer);
    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

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

                    $selectedInstances = CommandHelper::validateInstanceSelection($answer, $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

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

            CommandHelper::validateInstanceSelection($instancesOption, $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

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

            $email = CommandHelper::validateEmailInput($email);
    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

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

            $instances = CommandHelper::getInstances('update');
    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

    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

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

            $instances = CommandHelper::getInstances('update');
    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

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

                    return implode(',', CommandHelper::getInstanceIds($selectedInstances));
    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

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

                        return CommandHelper::validateEmailInput($value);
    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

    Possibly zero references to use statement for classlike/namespace App (\TikiManager\Config\App)
    Open

    use TikiManager\Config\App;
    Severity: Minor
    Found in src/Command/SetupUpdateCommand.php by phan

    There are no issues that match your filters.

    Category
    Status