bcit-ci/CodeIgniter

View on GitHub
system/libraries/Xmlrpc.php

Summary

Maintainability
F
1 wk
Test Coverage

File Xmlrpc.php has 959 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * CodeIgniter
 *
 * An open source application development framework for PHP
Severity: Major
Found in system/libraries/Xmlrpc.php - About 2 days to fix

    Method parseResponse has 99 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function parseResponse($fp)
        {
            $data = '';
    
            while ($datum = fread($fp, 4096))
    Severity: Major
    Found in system/libraries/Xmlrpc.php - About 3 hrs to fix

      Method closing_tag has 97 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function closing_tag($the_parser, $name)
          {
              $the_parser = (string) $the_parser;
      
              if ($this->xh[$the_parser]['isf'] > 1) return;
      Severity: Major
      Found in system/libraries/Xmlrpc.php - About 3 hrs to fix

        Function closing_tag has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            public function closing_tag($the_parser, $name)
            {
                $the_parser = (string) $the_parser;
        
                if ($this->xh[$the_parser]['isf'] > 1) return;
        Severity: Minor
        Found in system/libraries/Xmlrpc.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 parseResponse has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            public function parseResponse($fp)
            {
                $data = '';
        
                while ($datum = fread($fp, 4096))
        Severity: Minor
        Found in system/libraries/Xmlrpc.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 open_tag has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function open_tag($the_parser, $name)
            {
                $the_parser = (string) $the_parser;
        
                // If invalid nesting, then return
        Severity: Major
        Found in system/libraries/Xmlrpc.php - About 2 hrs to fix

          Method sendPayload has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function sendPayload($msg)
              {
                  if ($this->proxy === FALSE)
                  {
                      $server = $this->server;
          Severity: Major
          Found in system/libraries/Xmlrpc.php - About 2 hrs to fix

            Function open_tag has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                public function open_tag($the_parser, $name)
                {
                    $the_parser = (string) $the_parser;
            
                    // If invalid nesting, then return
            Severity: Minor
            Found in system/libraries/Xmlrpc.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 sendPayload has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                public function sendPayload($msg)
                {
                    if ($this->proxy === FALSE)
                    {
                        $server = $this->server;
            Severity: Minor
            Found in system/libraries/Xmlrpc.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

            Method __construct has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function __construct($config = array())
                {
                    $this->xmlrpc_backslash = chr(92).chr(92);
            
                    // Types for info sent back and forth
            Severity: Minor
            Found in system/libraries/Xmlrpc.php - About 1 hr to fix

              Method serializedata has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function serializedata($typ, $val)
                  {
                      $rs = '';
              
                      switch ($this->xmlrpcTypes[$typ])
              Severity: Minor
              Found in system/libraries/Xmlrpc.php - About 1 hr to fix

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

                    public function values_parsing($value)
                    {
                        if (is_array($value) && array_key_exists(0, $value))
                        {
                            if ( ! isset($value[1], $this->xmlrpcTypes[$value[1]]))
                Severity: Minor
                Found in system/libraries/Xmlrpc.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 output_parameters has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function output_parameters(array $array = array())
                    {
                        $CI =& get_instance();
                
                        if ( ! empty($array))
                Severity: Minor
                Found in system/libraries/Xmlrpc.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 serializedata has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function serializedata($typ, $val)
                    {
                        $rs = '';
                
                        switch ($this->xmlrpcTypes[$typ])
                Severity: Minor
                Found in system/libraries/Xmlrpc.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 output_parameters has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function output_parameters(array $array = array())
                    {
                        $CI =& get_instance();
                
                        if ( ! empty($array))
                Severity: Minor
                Found in system/libraries/Xmlrpc.php - About 1 hr to fix

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

                      public function addScalar($val, $type = 'string')
                      {
                          $typeof = $this->xmlrpcTypes[$type];
                  
                          if ($this->mytype === 1)
                  Severity: Minor
                  Found in system/libraries/Xmlrpc.php - About 1 hr to fix

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

                        public function xmlrpc_decoder($xmlrpc_val)
                        {
                            $kind = $xmlrpc_val->kindOf();
                    
                            if ($kind === 'scalar')
                    Severity: Minor
                    Found in system/libraries/Xmlrpc.php - About 1 hr to fix

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

                          public function decode($array = NULL)
                          {
                              $CI =& get_instance();
                      
                              if (is_array($array))
                      Severity: Minor
                      Found in system/libraries/Xmlrpc.php - About 1 hr to fix

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

                            public function decode_message($param)
                            {
                                $kind = $param->kindOf();
                        
                                if ($kind === 'scalar')
                        Severity: Minor
                        Found in system/libraries/Xmlrpc.php - About 1 hr to fix

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

                              public function decode($array = NULL)
                              {
                                  $CI =& get_instance();
                          
                                  if (is_array($array))
                          Severity: Minor
                          Found in system/libraries/Xmlrpc.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 __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public function __construct($path, $server, $port = 80, $proxy = FALSE, $proxy_port = 8080)
                          Severity: Minor
                          Found in system/libraries/Xmlrpc.php - About 35 mins to fix

                            Function xmlrpc_decoder has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function xmlrpc_decoder($xmlrpc_val)
                                {
                                    $kind = $xmlrpc_val->kindOf();
                            
                                    if ($kind === 'scalar')
                            Severity: Minor
                            Found in system/libraries/Xmlrpc.php - About 35 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 decode_message has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function decode_message($param)
                                {
                                    $kind = $param->kindOf();
                            
                                    if ($kind === 'scalar')
                            Severity: Minor
                            Found in system/libraries/Xmlrpc.php - About 35 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 new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'], $this->xmlrpcstr['invalid_return'].' '.$this->xh[$pname]['isf_reason']);
                            Severity: Major
                            Found in system/libraries/Xmlrpc.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                      return $r;
                              Severity: Major
                              Found in system/libraries/Xmlrpc.php - About 30 mins to fix

                                Function initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function initialize($config = array())
                                    {
                                        if (count($config) > 0)
                                        {
                                            foreach ($config as $key => $val)
                                Severity: Minor
                                Found in system/libraries/Xmlrpc.php - About 25 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 addScalar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function addScalar($val, $type = 'string')
                                    {
                                        $typeof = $this->xmlrpcTypes[$type];
                                
                                        if ($this->mytype === 1)
                                Severity: Minor
                                Found in system/libraries/Xmlrpc.php - About 25 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 character_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function character_data($the_parser, $data)
                                    {
                                        $the_parser = (string) $the_parser;
                                
                                        if ($this->xh[$the_parser]['isf'] > 1) return; // XML Fault found already
                                Severity: Minor
                                Found in system/libraries/Xmlrpc.php - About 25 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

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

                                    public function decode_message($param)
                                    {
                                        $kind = $param->kindOf();
                                
                                        if ($kind === 'scalar')
                                Severity: Major
                                Found in system/libraries/Xmlrpc.php and 1 other location - About 5 hrs to fix
                                system/libraries/Xmlrpc.php on lines 970..1002

                                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 201.

                                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

                                    public function xmlrpc_decoder($xmlrpc_val)
                                    {
                                        $kind = $xmlrpc_val->kindOf();
                                
                                        if ($kind === 'scalar')
                                Severity: Major
                                Found in system/libraries/Xmlrpc.php and 1 other location - About 5 hrs to fix
                                system/libraries/Xmlrpc.php on lines 1609..1642

                                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 201.

                                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

                                There are no issues that match your filters.

                                Category
                                Status