amercier/php-cli-helpers

View on GitHub
src/Cli/Helpers/Script.php

Summary

Maintainability
A
1 hr
Test Coverage
B
86%

Function processParameters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function processParameters($arguments)
    {
        // Get parameter values without throwing exceptions in case of missing
        // required parameter (ex: my-sctipt -h misses -u)
        $options = array();
Severity: Minor
Found in src/Cli/Helpers/Script.php - About 55 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

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

    public function addParameter($parameter, $description, $callback = null)
    {

        // Check whether a parameter with the same switch already exists
        foreach ($this->parameters as $p) {
Severity: Minor
Found in src/Cli/Helpers/Script.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

There are no issues that match your filters.

Category
Status