TikiWiki/tiki-manager

View on GitHub
src/Libs/VersionControl/VersionControlSystem.php

Summary

Maintainability
A
2 hrs
Test Coverage

getVersionControlSystem accesses the super-global variable $_ENV.
Open

    public static function getVersionControlSystem(Instance $instance)
    {
        $type = $instance->vcs_type ?? $_ENV['DEFAULT_VCS'];
        $vcsInstance = null;

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

The class VersionControlSystem has 11 public methods. Consider refactoring VersionControlSystem to keep number of public methods under 10.
Open

abstract class VersionControlSystem implements LoggerAwareInterface
{
    use LoggerAwareTrait;

    protected $command;

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

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

VersionControlSystem has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class VersionControlSystem implements LoggerAwareInterface
{
    use LoggerAwareTrait;

    protected $command;
Severity: Minor
Found in src/Libs/VersionControl/VersionControlSystem.php - About 2 hrs to fix

    The method getIdentifier has a boolean flag argument $isCapitalized, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public function getIdentifier($isCapitalized = false)

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

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

    The method info has a boolean flag argument $raw, which is a certain sign of a Single Responsibility Principle violation.
    Open

        abstract public function info($targetFolder, $raw = false);

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

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

    Saw an @param annotation for options, but it was not found in the param list of function __construct(\TikiManager\Application\Instance $instance, array $vcsOptions = null, ?\Psr\Log\LoggerInterface $logger = null)
    Open

         * @param array $options An array with settings on how the VCS should behaviour

    There are no issues that match your filters.

    Category
    Status