atelierspierrot/library

View on GitHub
src/Library/CommandLine/AbstractCommandLineController.php

Summary

Maintainability
F
3 days
Test Coverage

File AbstractCommandLineController.php has 455 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * This file is part of the Library package.
 *
 * Copyleft (ↄ) 2013-2016 Pierre Cassat <me@e-piwi.fr> and contributors
Severity: Minor
Found in src/Library/CommandLine/AbstractCommandLineController.php - About 6 hrs to fix

    AbstractCommandLineController has 49 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class AbstractCommandLineController
        implements CommandLineControllerInterface
    {
    
        /**
    Severity: Minor
    Found in src/Library/CommandLine/AbstractCommandLineController.php - About 6 hrs to fix

      Function _treatOptions has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function _treatOptions()
          {
              $this->params = self::getopt();
              $this->debugWrite( ">> Command line arguments are [".var_export($this->params,1)."]" );
      
      
      Severity: Minor
      Found in src/Library/CommandLine/AbstractCommandLineController.php - About 3 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 __construct has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __construct(array $options = array())
          {
      //        if (!isset($this->options)) $this->options = array();
              $this
                  ->_initOptions()
      Severity: Minor
      Found in src/Library/CommandLine/AbstractCommandLineController.php - About 3 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

      Method _treatOptions has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function _treatOptions()
          {
              $this->params = self::getopt();
              $this->debugWrite( ">> Command line arguments are [".var_export($this->params,1)."]" );
      
      
      Severity: Minor
      Found in src/Library/CommandLine/AbstractCommandLineController.php - About 1 hr to fix

        Function _overWriteOptions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function _overWriteOptions(array $options)
            {
                if (!empty($options)) {
                    foreach ($options as $name=>$stack) {
                        if (is_array($stack)) {
        Severity: Minor
        Found in src/Library/CommandLine/AbstractCommandLineController.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

        Function runHelpCommand has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function runHelpCommand($opt = null)
            {
                if (!empty($opt)) {
                    if (!is_array($opt)) $opt = array( $opt=>'' );
                    $opt_keys = array_keys($opt);
        Severity: Minor
        Found in src/Library/CommandLine/AbstractCommandLineController.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 __construct has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function __construct(array $options = array())
            {
        //        if (!isset($this->options)) $this->options = array();
                $this
                    ->_initOptions()
        Severity: Minor
        Found in src/Library/CommandLine/AbstractCommandLineController.php - About 1 hr to fix

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

              public function usage($opt = null)
              {
                  if (!empty($opt)) {
                      if (!is_array($opt)) $opt = array( $opt=>'' );
                      $opt_keys = array_keys($opt);
          Severity: Minor
          Found in src/Library/CommandLine/AbstractCommandLineController.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

          There are no issues that match your filters.

          Category
          Status