amtgard/ORK3

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

Summary

Maintainability
F
1 mo
Test Coverage

Function schemaStartElement has a Cognitive Complexity of 117 (exceeds 5 allowed). Consider refactoring.
Open

    function schemaStartElement($parser, $name, $attrs) {
        
        // position in the total number of elements, starting from 0
        $pos = $this->position++;
        $depth = $this->depth++;
Severity: Minor
Found in system/lib/nusoap/class.xmlschema.php - About 2 days 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 serializeSchema has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
Open

    function serializeSchema(){

        $schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion);
        $xml = '';
        // imports
Severity: Minor
Found in system/lib/nusoap/class.xmlschema.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

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

<?php




Severity: Major
Found in system/lib/nusoap/class.xmlschema.php - About 1 day to fix

    Method schemaStartElement has 266 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function schemaStartElement($parser, $name, $attrs) {
            
            // position in the total number of elements, starting from 0
            $pos = $this->position++;
            $depth = $this->depth++;
    Severity: Major
    Found in system/lib/nusoap/class.xmlschema.php - About 1 day to fix

      Function getTypeDef has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
      Open

          function getTypeDef($type){
              //$this->debug("in getTypeDef for type $type");
              if (substr($type, -1) == '^') {
                  $is_element = 1;
                  $type = substr($type, 0, -1);
      Severity: Minor
      Found in system/lib/nusoap/class.xmlschema.php - About 5 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 serializeSchema has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function serializeSchema(){
      
              $schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion);
              $xml = '';
              // imports
      Severity: Major
      Found in system/lib/nusoap/class.xmlschema.php - About 3 hrs to fix

        Method getTypeDef has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function getTypeDef($type){
                //$this->debug("in getTypeDef for type $type");
                if (substr($type, -1) == '^') {
                    $is_element = 1;
                    $type = substr($type, 0, -1);
        Severity: Major
        Found in system/lib/nusoap/class.xmlschema.php - About 2 hrs to fix

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

              function serializeTypeDef($type){
                  //print "in sTD() for type $type<br>";
              if($typeDef = $this->getTypeDef($type)){
                  $str .= '<'.$type;
                  if(is_array($typeDef['attrs'])){
          Severity: Minor
          Found in system/lib/nusoap/class.xmlschema.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 typeToForm has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              function typeToForm($name,$type){
                  // get typedef
                  if($typeDef = $this->getTypeDef($type)){
                      // if struct
                      if($typeDef['phpType'] == 'struct'){
          Severity: Minor
          Found in system/lib/nusoap/class.xmlschema.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 addComplexType has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType=''){
          Severity: Major
          Found in system/lib/nusoap/class.xmlschema.php - About 1 hr to fix

            Method addSimpleType has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) {
            Severity: Minor
            Found in system/lib/nusoap/class.xmlschema.php - About 35 mins to fix

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

                  function parseString($xml,$type){
                      // parse xml string
                      if($xml != ""){
              
                          // Create an XML parser.
              Severity: Minor
              Found in system/lib/nusoap/class.xmlschema.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 false;
              Severity: Major
              Found in system/lib/nusoap/class.xmlschema.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return $typeDef;
                Severity: Major
                Found in system/lib/nusoap/class.xmlschema.php - About 30 mins to fix

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

                      function schemaEndElement($parser, $name) {
                          // bring depth down a notch
                          $this->depth--;
                          // position of current element is equal to the last value left in depth_array for my depth
                          if(isset($this->depth_array[$this->depth])){
                  Severity: Minor
                  Found in system/lib/nusoap/class.xmlschema.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

                  class nusoap_xmlschema extends nusoap_base  {
                      
                      // files
                      var $schema = '';
                      var $xml = '';
                  Severity: Major
                  Found in system/lib/nusoap/class.xmlschema.php and 1 other location - About 1 mo to fix
                  system/lib/nusoap/nusoap.php on lines 1095..2044

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

                  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