amercier/php-cli-helpers

View on GitHub

Showing 7 of 7 total issues

Method addHelpParameter has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function addHelpParameter()
    {
        $this->addParameter(
            new Parameter('h', 'help', Parameter::VALUE_NO_VALUE),
            'Display this help and exit.',
Severity: Minor
Found in src/Cli/Helpers/DocumentedScript.php - About 1 hr to fix

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

        public function getValue($arguments)
        {
            // Parse arguments
            $index = -1;
            foreach ($arguments as $i => $value) {
    Severity: Minor
    Found in src/Cli/Helpers/Parameter.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 strPadAll has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function strPadAll(
            $lines,
            $modes = array(),
            $lineSeparator = "\n",
            $columnSeparator = ' ',
    Severity: Minor
    Found in src/Cli/Helpers/IO.php - About 1 hr to fix

      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

      Method strPadAll has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              $lines,
              $modes = array(),
              $lineSeparator = "\n",
              $columnSeparator = ' ',
              $fillCharacter = ' ',
      Severity: Minor
      Found in src/Cli/Helpers/IO.php - About 45 mins to fix

        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

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

            public static function strPadAll(
                $lines,
                $modes = array(),
                $lineSeparator = "\n",
                $columnSeparator = ' ',
        Severity: Minor
        Found in src/Cli/Helpers/IO.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

        Severity
        Category
        Status
        Source
        Language