atelierspierrot/library

View on GitHub

Showing 159 of 159 total issues

Session has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class Session
    implements SessionInterface
{

    /**
Severity: Minor
Found in src/Library/Session/Session.php - About 2 hrs to fix

    Router has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Router
        implements RouterInterface
    {
    
        /**
    Severity: Minor
    Found in src/Library/Router.php - About 2 hrs to fix

      Method render has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function render($str_pad_flag = STR_PAD_RIGHT)
          {
              $stacks = array();
              if ($this->column_size===0 && $this->line_size===0 && $this->cell_size===0) {
                  $this->_parseTableSizes();
      Severity: Major
      Found in src/Library/Tool/Table.php - About 2 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                    if (!empty($this->must_implement) && !$this->_classesImplements($_cls, $this->must_implement, false, $logs)) {
                        $logs[] = $this->_getErrorMessage(
                            count($this->must_implement)>1 ? 'Class "%s" must implement one of the following interfaces "%s"!' : 'Class "%s" must implement interface "%s"!',
                            $_cls, implode('", "', $this->must_implement));
                        if ($flag & self::ERROR_ON_FAILURE) {
        Severity: Major
        Found in src/Library/Factory.php and 1 other location - About 2 hrs to fix
        src/Library/Factory.php on lines 396..404

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 124.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                    if (!empty($this->must_implement_all) && !$this->_classesImplements($_cls, $this->must_implement_all, true, $logs)) {
                        $logs[] = $this->_getErrorMessage(
                            count($this->must_implement_all)>1 ? 'Class "%s" must implement the following interfaces "%s"!' : 'Class "%s" must implement interface "%s"!',
                            $_cls, implode('", "', $this->must_implement_all));
                        if ($flag & self::ERROR_ON_FAILURE) {
        Severity: Major
        Found in src/Library/Factory.php and 1 other location - About 2 hrs to fix
        src/Library/Factory.php on lines 385..393

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 124.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function init has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            public function init(
                array $initial_services     = array(),
                array $services_providers   = array(),
                array $services_protected   = array()
            ) {
        Severity: Minor
        Found in src/Library/ServiceContainer/ServiceContainer.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 __getReflection has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            private function __getReflection()
            {
                if (self::get_objectType() & self::PARSE_FUNC) {
                    if (function_exists(self::get_objectName()))
                        $this->reflection = new ReflectionFunction( self::get_objectName() ); 
        Severity: Minor
        Found in src/Library/CodeParser.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 renderTag has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            public function renderTag($content, $tag_type = 'default', array $args = array())
            {
                switch($tag_type) {
        
                    // case of the tables ($content is an array of lines that are an array of cells)
        Severity: Minor
        Found in src/Library/Reporter/Adapter/Html.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 _setPartCell has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function _setPartCell($content, $line_index, $cell_index, $part, $action = 'replace')
            {
                if (property_exists($this, $part)) {
                    if (is_null($line_index)) {
                        end($this->{$part});
        Severity: Minor
        Found in src/Library/Tool/Table.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

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                foreach($tmp_alias_list as $_meth=>$_options) {
                    $title = str_replace( ':', '', implode('|', $_options) );
                    if (substr_count(implode('|', $_options),'::'))
                        $title .= ' <opt.arg>';
                    elseif (substr_count(implode('|', $_options),':'))
        Severity: Major
        Found in src/Library/CommandLine/Helper.php and 2 other locations - About 2 hrs to fix
        src/Library/CommandLine/Helper.php on lines 167..174
        src/Library/CommandLine/Helper.php on lines 183..190

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 122.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                foreach($tmp_options_list as $_meth=>$_options) {
                    $title = str_replace( ':', '', implode('|', $_options) );
                    if (substr_count(implode('|', $_options),'::'))
                        $title .= ' <opt.arg>';
                    elseif (substr_count(implode('|', $_options),':'))
        Severity: Major
        Found in src/Library/CommandLine/Helper.php and 2 other locations - About 2 hrs to fix
        src/Library/CommandLine/Helper.php on lines 183..190
        src/Library/CommandLine/Helper.php on lines 199..206

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 122.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                foreach($tmp_commands_list as $_meth=>$_options) {
                    $title = str_replace( ':', '', implode('|', $_options) );
                    if (substr_count(implode('|', $_options),'::'))
                        $title .= ' <opt.arg>';
                    elseif (substr_count(implode('|', $_options),':'))
        Severity: Major
        Found in src/Library/CommandLine/Helper.php and 2 other locations - About 2 hrs to fix
        src/Library/CommandLine/Helper.php on lines 167..174
        src/Library/CommandLine/Helper.php on lines 199..206

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 122.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Method getTableIterator has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getTableIterator($part = 'body', $iterator_flag = self::ITERATE_ON_LINES)
            {
                $this->_repadAllLines();
                $table = $this->getTable();
                unset($table['title']);
        Severity: Minor
        Found in src/Library/Tool/Table.php - About 1 hr to fix

          Function copy has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function copy($file_path = null, $target_path = null, $force = false, array &$logs = array())
              {
                  if (is_null($file_path) || is_null($target_path)) {
                      return null;
                  }
          Severity: Minor
          Found in src/Library/Helper/File.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 load has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function load($class_name = null)
              {
                  if (empty(self::$__registry) && empty(self::$__configurator) && empty($class_name)) {
                      $class_name = self::getInternal('config-class');
                      if (empty($class_name)) {
          Severity: Minor
          Found in src/Library/StaticConfiguration/Config.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 url has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function url($param = null, $value = null, $url = null)
              {
                  if (is_null($param)) {
                      return '';
                  }
          Severity: Minor
          Found in src/Library/Helper/Url.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 intToRoman has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function intToRoman($a = null)
              {
                  if (is_null($a)) {
                      return null;
                  }
          Severity: Minor
          Found in src/Library/Helper/RomanNumber.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 _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

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

                public static function formatHelpString($title = null, $contents = null, Formater $formater)
                {
                    if (empty($contents)) return '';
                    if (empty($title)) $title = 'Help';
                    if (!is_array($contents)) $contents = array( $contents );
            Severity: Minor
            Found in src/Library/CommandLine/Helper.php - About 1 hr to fix

              Function rotate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function rotate($force = false)
                  {
                      $rotator = $this->options['backup_time'];
              
                      if (true===$force || $this->mustRotate()) {
              Severity: Minor
              Found in src/Library/Tool/FileRotator.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

              Severity
              Category
              Status
              Source
              Language