TikiWiki/tiki-manager

View on GitHub
src/Command/Traits/InstanceConfigure.php

Summary

Maintainability
F
3 days
Test Coverage

setupDatabase accesses the super-global variable $_ENV.
Open

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

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

setupDatabase accesses the super-global variable $_ENV.
Open

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

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

setupDatabase accesses the super-global variable $_ENV.
Open

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

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

File InstanceConfigure.php has 492 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace TikiManager\Command\Traits;

use Psr\Log\LoggerAwareTrait;
Severity: Minor
Found in src/Command/Traits/InstanceConfigure.php - About 7 hrs to fix

    Method setupInstance has 119 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function setupInstance(Instance $instance, $import = false) : Instance
        {
            $url = $this->input->getOption('url') ?: $instance->getDiscovery()->detectWeburl();
            $url = $this->io->ask('WebUrl', $url, function ($value) {
                if (empty($value)) {
    Severity: Major
    Found in src/Command/Traits/InstanceConfigure.php - About 4 hrs to fix

      Method setupDatabase has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function setupDatabase(Instance $instance, $reconfigure = false): Instance
          {
              try {
                  if (!$reconfigure && $this->testExistingDbConnection($instance)) {
                      return $instance;
      Severity: Major
      Found in src/Command/Traits/InstanceConfigure.php - About 3 hrs to fix

        Method isMissingPHPRequirements has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function isMissingPHPRequirements(Instance $instance, LoggerInterface $log): bool
            {
                return false;
                $missingRequirements = [];
                $access = $instance->getBestAccess();
        Severity: Major
        Found in src/Command/Traits/InstanceConfigure.php - About 2 hrs to fix

          Function isMissingPHPRequirements has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              public function isMissingPHPRequirements(Instance $instance, LoggerInterface $log): bool
              {
                  return false;
                  $missingRequirements = [];
                  $access = $instance->getBestAccess();
          Severity: Minor
          Found in src/Command/Traits/InstanceConfigure.php - About 2 hrs to fix

          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

          Function setupDatabase has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              public function setupDatabase(Instance $instance, $reconfigure = false): Instance
              {
                  try {
                      if (!$reconfigure && $this->testExistingDbConnection($instance)) {
                          return $instance;
          Severity: Minor
          Found in src/Command/Traits/InstanceConfigure.php - About 1 hr to fix

          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 setupRemoteAccess has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function setupRemoteAccess(Access $access)
              {
                  $host = $this->io->ask('Host', $this->input->getOption('host') ?? '', function ($value) {
                      return !empty($value) ? $value : new InvalidOptionException("You must provide a valid remote host. Please use --host=<HOST>");
                  });
          Severity: Minor
          Found in src/Command/Traits/InstanceConfigure.php - About 1 hr to fix

            Method install has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function install(Instance $instance): Instance
                {
                    $checksumCheck = $this->input->getOption('check') ?? false;
            
                    $discovery = $instance->getDiscovery();
            Severity: Minor
            Found in src/Command/Traits/InstanceConfigure.php - About 1 hr to fix

              Method setupApplication has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function setupApplication(Instance $instance): Instance
                  {
                      if ($this->input->getOption('blank')) {
                          $instance->selection = 'blank : none';
                          return $instance;
              Severity: Minor
              Found in src/Command/Traits/InstanceConfigure.php - About 1 hr to fix

                Function setupApplication has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function setupApplication(Instance $instance): Instance
                    {
                        if ($this->input->getOption('blank')) {
                            $instance->selection = 'blank : none';
                            return $instance;
                Severity: Minor
                Found in src/Command/Traits/InstanceConfigure.php - About 45 mins to fix

                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

                Avoid too many return statements within this method.
                Open

                        return $instance;
                Severity: Major
                Found in src/Command/Traits/InstanceConfigure.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return $instance;
                  Severity: Major
                  Found in src/Command/Traits/InstanceConfigure.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return $value;
                    Severity: Major
                    Found in src/Command/Traits/InstanceConfigure.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return $value;
                      Severity: Major
                      Found in src/Command/Traits/InstanceConfigure.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return $value;
                        Severity: Major
                        Found in src/Command/Traits/InstanceConfigure.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return $value;
                          Severity: Major
                          Found in src/Command/Traits/InstanceConfigure.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return $value;
                            Severity: Major
                            Found in src/Command/Traits/InstanceConfigure.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                              return $this->handleNotEmptyWebrootFolder($value);
                              Severity: Major
                              Found in src/Command/Traits/InstanceConfigure.php - About 30 mins to fix

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

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

                                The method setupInstance() has an NPath complexity of 403107840. The configured NPath complexity threshold is 200.
                                Open

                                    public function setupInstance(Instance $instance, $import = false) : Instance
                                    {
                                        $url = $this->input->getOption('url') ?: $instance->getDiscovery()->detectWeburl();
                                        $url = $this->io->ask('WebUrl', $url, function ($value) {
                                            if (empty($value)) {

                                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 setupInstance() has 175 lines of code. Current threshold is set to 100. Avoid really long methods.
                                Open

                                    public function setupInstance(Instance $instance, $import = false) : Instance
                                    {
                                        $url = $this->input->getOption('url') ?: $instance->getDiscovery()->detectWeburl();
                                        $url = $this->io->ask('WebUrl', $url, function ($value) {
                                            if (empty($value)) {

                                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 isMissingPHPRequirements() has an NPath complexity of 276480. The configured NPath complexity threshold is 200.
                                Open

                                    public function isMissingPHPRequirements(Instance $instance, LoggerInterface $log): bool
                                    {
                                        return false;
                                        $missingRequirements = [];
                                        $access = $instance->getBestAccess();

                                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 setupInstance() has a Cyclomatic Complexity of 37. The configured cyclomatic complexity threshold is 10.
                                Open

                                    public function setupInstance(Instance $instance, $import = false) : Instance
                                    {
                                        $url = $this->input->getOption('url') ?: $instance->getDiscovery()->detectWeburl();
                                        $url = $this->io->ask('WebUrl', $url, function ($value) {
                                            if (empty($value)) {

                                CyclomaticComplexity

                                Since: 0.1

                                Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                Example

                                // Cyclomatic Complexity = 11
                                class Foo {
                                1   public function example() {
                                2       if ($a == $b) {
                                3           if ($a1 == $b1) {
                                                fiddle();
                                4           } elseif ($a2 == $b2) {
                                                fiddle();
                                            } else {
                                                fiddle();
                                            }
                                5       } elseif ($c == $d) {
                                6           while ($c == $d) {
                                                fiddle();
                                            }
                                7        } elseif ($e == $f) {
                                8           for ($n = 0; $n < $h; $n++) {
                                                fiddle();
                                            }
                                        } else {
                                            switch ($z) {
                                9               case 1:
                                                    fiddle();
                                                    break;
                                10              case 2:
                                                    fiddle();
                                                    break;
                                11              case 3:
                                                    fiddle();
                                                    break;
                                                default:
                                                    fiddle();
                                                    break;
                                            }
                                        }
                                    }
                                }

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

                                The method setupDatabase() has a Cyclomatic Complexity of 35. The configured cyclomatic complexity threshold is 10.
                                Open

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

                                CyclomaticComplexity

                                Since: 0.1

                                Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                Example

                                // Cyclomatic Complexity = 11
                                class Foo {
                                1   public function example() {
                                2       if ($a == $b) {
                                3           if ($a1 == $b1) {
                                                fiddle();
                                4           } elseif ($a2 == $b2) {
                                                fiddle();
                                            } else {
                                                fiddle();
                                            }
                                5       } elseif ($c == $d) {
                                6           while ($c == $d) {
                                                fiddle();
                                            }
                                7        } elseif ($e == $f) {
                                8           for ($n = 0; $n < $h; $n++) {
                                                fiddle();
                                            }
                                        } else {
                                            switch ($z) {
                                9               case 1:
                                                    fiddle();
                                                    break;
                                10              case 2:
                                                    fiddle();
                                                    break;
                                11              case 3:
                                                    fiddle();
                                                    break;
                                                default:
                                                    fiddle();
                                                    break;
                                            }
                                        }
                                    }
                                }

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

                                The method isMissingPHPRequirements() has a Cyclomatic Complexity of 23. The configured cyclomatic complexity threshold is 10.
                                Open

                                    public function isMissingPHPRequirements(Instance $instance, LoggerInterface $log): bool
                                    {
                                        return false;
                                        $missingRequirements = [];
                                        $access = $instance->getBestAccess();

                                CyclomaticComplexity

                                Since: 0.1

                                Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                Example

                                // Cyclomatic Complexity = 11
                                class Foo {
                                1   public function example() {
                                2       if ($a == $b) {
                                3           if ($a1 == $b1) {
                                                fiddle();
                                4           } elseif ($a2 == $b2) {
                                                fiddle();
                                            } else {
                                                fiddle();
                                            }
                                5       } elseif ($c == $d) {
                                6           while ($c == $d) {
                                                fiddle();
                                            }
                                7        } elseif ($e == $f) {
                                8           for ($n = 0; $n < $h; $n++) {
                                                fiddle();
                                            }
                                        } else {
                                            switch ($z) {
                                9               case 1:
                                                    fiddle();
                                                    break;
                                10              case 2:
                                                    fiddle();
                                                    break;
                                11              case 3:
                                                    fiddle();
                                                    break;
                                                default:
                                                    fiddle();
                                                    break;
                                            }
                                        }
                                    }
                                }

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

                                Missing class import via use statement (line '606', column '23').
                                Open

                                            throw new \Exception($error);

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '455', column '23').
                                Open

                                            throw new \Exception('Unable to access database.');

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '131', column '23').
                                Open

                                            throw new \Exception();

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '217', column '27').
                                Open

                                                throw new \Exception($error);

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '348', column '23').
                                Open

                                            throw new \Exception('An error occurred while registering instance/application details', 2);

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

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

                                    public function setupDatabase(Instance $instance, $reconfigure = false): Instance

                                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

                                Missing class import via use statement (line '243', column '27').
                                Open

                                                throw new \Exception('Unable to create the directory: ' . $value);

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '339', column '23').
                                Open

                                            throw new \Exception('Unable to import. An application was not detected in this instance.');

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '227', column '27').
                                Open

                                                throw new \Exception('Directory not created');

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '247', column '27').
                                Open

                                                throw new \Exception('Directory not created');

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '613', column '23').
                                Open

                                            throw new \Exception($message . ' Select a different path.');

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '223', column '27').
                                Open

                                                throw new \Exception('Unable to create the directory: ' . $value);

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

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

                                    public function setupInstance(Instance $instance, $import = false) : Instance

                                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

                                Missing class import via use statement (line '391', column '23').
                                Open

                                            throw new \Exception('Selected branch not found.');

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '511', column '35').
                                Open

                                                        throw new \Exception("Prefix is a string with maximum of {$maxPrefixLength} chars");

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '493', column '31').
                                Open

                                                    throw new \Exception("Database does not exist and user cannot create.");

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '516', column '35').
                                Open

                                                        throw new \Exception("User '$username' already exists, can't proceed.");

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

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

                                        $type = $this->io->choice('Connection type', CommandHelper::supportedInstanceTypes(), $type);

                                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 'printManagerInfo'.
                                Open

                                        CommandHelper::displayInfo($mockDiscovery);

                                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 isMissingPHPRequirements uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                        } else {
                                            $memoryLimit = (int) $accessMemoryLimit;
                                        }

                                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 '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

                                Avoid assigning values to variables in if clauses and the like (line '303', column '28').
                                Open

                                    public function setupInstance(Instance $instance, $import = false) : Instance
                                    {
                                        $url = $this->input->getOption('url') ?: $instance->getDiscovery()->detectWeburl();
                                        $url = $this->io->ask('WebUrl', $url, function ($value) {
                                            if (empty($value)) {

                                IfStatementAssignment

                                Since: 2.7.0

                                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($foo = 'bar') { // possible typo
                                            // ...
                                        }
                                        if ($baz = 0) { // always false
                                            // ...
                                        }
                                    }
                                }

                                Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

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

                                        $version = Version::buildFake($details[0], $details[1]);

                                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 isMissingPHPRequirements uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                            } else {
                                                $memoryLimit = (int) $accessMemoryLimit;
                                            }

                                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 {
                                            $defaultHost = 'localhost';
                                            $defaultUser = 'root';
                                            $defaultPass = null;
                                        }

                                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

                                Possibly zero references to use statement for classlike/namespace Tiki (\TikiManager\Application\Tiki)
                                Open

                                use TikiManager\Application\Tiki;

                                The variable $is_blank is not named in camelCase.
                                Open

                                    public function setupInstance(Instance $instance, $import = false) : Instance
                                    {
                                        $url = $this->input->getOption('url') ?: $instance->getDiscovery()->detectWeburl();
                                        $url = $this->io->ask('WebUrl', $url, function ($value) {
                                            if (empty($value)) {

                                CamelCaseVariableName

                                Since: 0.2

                                It is considered best practice to use the camelCase notation to name variables.

                                Example

                                class ClassName {
                                    public function doSomething() {
                                        $data_module = new DataModule();
                                    }
                                }

                                Source

                                The variable $is_blank is not named in camelCase.
                                Open

                                    public function setupInstance(Instance $instance, $import = false) : Instance
                                    {
                                        $url = $this->input->getOption('url') ?: $instance->getDiscovery()->detectWeburl();
                                        $url = $this->io->ask('WebUrl', $url, function ($value) {
                                            if (empty($value)) {

                                CamelCaseVariableName

                                Since: 0.2

                                It is considered best practice to use the camelCase notation to name variables.

                                Example

                                class ClassName {
                                    public function doSomething() {
                                        $data_module = new DataModule();
                                    }
                                }

                                Source

                                There are no issues that match your filters.

                                Category
                                Status