amtgard/ORK3

View on GitHub
system/lib/nusoap/class.soap_parser.php

Summary

Maintainability
F
1 mo
Test Coverage

Function buildVal has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
Open

    function buildVal($pos){
        if(!isset($this->message[$pos]['type'])){
            $this->message[$pos]['type'] = '';
        }
        $this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']);
Severity: Minor
Found in system/lib/nusoap/class.soap_parser.php - About 1 day 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 start_element has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
Open

    function start_element($parser, $name, $attrs) {
        // position in a total number of elements, starting from 0
        // update class level pos
        $pos = $this->position++;
        // and set mine
Severity: Minor
Found in system/lib/nusoap/class.soap_parser.php - About 1 day 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 end_element has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

    function end_element($parser, $name) {
        // position of current element is equal to the last value left in depth_array for my depth
        $pos = $this->depth_array[$this->depth--];

        // get element prefix
Severity: Minor
Found in system/lib/nusoap/class.soap_parser.php - About 6 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 nusoap_parser has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

    function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
        parent::nusoap_base();
        $this->xml = $xml;
        $this->xml_encoding = $encoding;
        $this->method = $method;
Severity: Minor
Found in system/lib/nusoap/class.soap_parser.php - About 6 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

File class.soap_parser.php has 431 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php




Severity: Minor
Found in system/lib/nusoap/class.soap_parser.php - About 6 hrs to fix

    Method start_element has 105 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function start_element($parser, $name, $attrs) {
            // position in a total number of elements, starting from 0
            // update class level pos
            $pos = $this->position++;
            // and set mine
    Severity: Major
    Found in system/lib/nusoap/class.soap_parser.php - About 4 hrs to fix

      Method buildVal has 94 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function buildVal($pos){
              if(!isset($this->message[$pos]['type'])){
                  $this->message[$pos]['type'] = '';
              }
              $this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']);
      Severity: Major
      Found in system/lib/nusoap/class.soap_parser.php - About 3 hrs to fix

        Method nusoap_parser has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function nusoap_parser($xml,$encoding='UTF-8',$method='',$decode_utf8=true){
                parent::nusoap_base();
                $this->xml = $xml;
                $this->xml_encoding = $encoding;
                $this->method = $method;
        Severity: Major
        Found in system/lib/nusoap/class.soap_parser.php - About 2 hrs to fix

          Method end_element has 65 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function end_element($parser, $name) {
                  // position of current element is equal to the last value left in depth_array for my depth
                  $pos = $this->depth_array[$this->depth--];
          
                  // get element prefix
          Severity: Major
          Found in system/lib/nusoap/class.soap_parser.php - About 2 hrs to fix

            Method decodeSimple has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function decodeSimple($value, $type, $typens) {
                    // TODO: use the namespace!
                    if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') {
                        return (string) $value;
                    }
            Severity: Minor
            Found in system/lib/nusoap/class.soap_parser.php - About 1 hr to fix

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

                  function decodeSimple($value, $type, $typens) {
                      // TODO: use the namespace!
                      if ((!isset($type)) || $type == 'string' || $type == 'long' || $type == 'unsignedLong') {
                          return (string) $value;
                      }
              Severity: Minor
              Found in system/lib/nusoap/class.soap_parser.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

              Consider simplifying this complex logical expression.
              Open

                      if ($type == 'nonPositiveInteger' || $type == 'negativeInteger'
                          || $type == 'nonNegativeInteger' || $type == 'positiveInteger'
                          || $type == 'unsignedInt'
                          || $type == 'unsignedShort' || $type == 'unsignedByte') {
                          return (int) $value;
              Severity: Major
              Found in system/lib/nusoap/class.soap_parser.php - About 1 hr to fix

                Avoid too many return statements within this method.
                Open

                            return (int) $value;
                Severity: Major
                Found in system/lib/nusoap/class.soap_parser.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return (string) $value;
                  Severity: Major
                  Found in system/lib/nusoap/class.soap_parser.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return base64_decode($value);
                    Severity: Major
                    Found in system/lib/nusoap/class.soap_parser.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return array();
                      Severity: Major
                      Found in system/lib/nusoap/class.soap_parser.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return (boolean) $value;
                        Severity: Major
                        Found in system/lib/nusoap/class.soap_parser.php - About 30 mins to fix

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

                          class nusoap_parser extends nusoap_base {
                          
                              var $xml = '';
                              var $xml_encoding = '';
                              var $method = '';
                          Severity: Major
                          Found in system/lib/nusoap/class.soap_parser.php and 1 other location - About 1 mo to fix
                          system/lib/nusoap/nusoap.php on lines 6532..7151

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

                          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