amtgard/ORK3

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

Summary

Maintainability
F
2 mos
Test Coverage

Function getResponse has a Cognitive Complexity of 201 (exceeds 5 allowed). Consider refactoring.
Open

    function getResponse(){
        $this->incoming_payload = '';
        
      if ($this->io_method() == 'socket') {
        // loop until headers have been retrieved
Severity: Minor
Found in system/lib/nusoap/class.soap_transport_http.php - About 4 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 connect has a Cognitive Complexity of 153 (exceeds 5 allowed). Consider refactoring.
Open

    function connect($connection_timeout=0,$response_timeout=30){
          // For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like
          // "regular" socket.
          // TODO: disabled for now because OpenSSL must be *compiled* in (not just
          //       loaded), and until PHP5 stream_get_wrappers is not available.
Severity: Minor
Found in system/lib/nusoap/class.soap_transport_http.php - About 3 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

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

<?php




Severity: Major
Found in system/lib/nusoap/class.soap_transport_http.php - About 2 days to fix

    Method getResponse has 298 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function getResponse(){
            $this->incoming_payload = '';
            
          if ($this->io_method() == 'socket') {
            // loop until headers have been retrieved
    Severity: Major
    Found in system/lib/nusoap/class.soap_transport_http.php - About 1 day to fix

      Method connect has 172 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function connect($connection_timeout=0,$response_timeout=30){
                // For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like
                // "regular" socket.
                // TODO: disabled for now because OpenSSL must be *compiled* in (not just
                //       loaded), and until PHP5 stream_get_wrappers is not available.
      Severity: Major
      Found in system/lib/nusoap/class.soap_transport_http.php - About 6 hrs to fix

        Function getCookiesForRequest has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
        Open

            function getCookiesForRequest($cookies, $secure=false) {
                $cookie_str = '';
                if ((! is_null($cookies)) && (is_array($cookies))) {
                    foreach ($cookies as $cookie) {
                        if (! is_array($cookie)) {
        Severity: Minor
        Found in system/lib/nusoap/class.soap_transport_http.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

        Function sendRequest has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

            function sendRequest($data, $cookies = NULL) {
                // build cookie string
                $cookie_str = $this->getCookiesForRequest($cookies, (($this->scheme == 'ssl') || ($this->scheme == 'https')));
        
                // build payload
        Severity: Minor
        Found in system/lib/nusoap/class.soap_transport_http.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

        soap_transport_http has 22 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class soap_transport_http extends nusoap_base {
        
            var $url = '';
            var $uri = '';
            var $digest_uri = '';
        Severity: Minor
        Found in system/lib/nusoap/class.soap_transport_http.php - About 2 hrs to fix

          Method parseCookie has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function parseCookie($cookie_str) {
                  $cookie_str = str_replace('; ', ';', $cookie_str) . ';';
                  $data = preg_split('/;/', $cookie_str);
                  $value_str = $data[0];
          
          
          Severity: Minor
          Found in system/lib/nusoap/class.soap_transport_http.php - About 1 hr to fix

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

                function setCredentials($username, $password, $authtype = 'basic', $digestRequest = array(), $certRequest = array()) {
                    $this->debug("setCredentials username=$username authtype=$authtype digestRequest=");
                    $this->appendDebug($this->varDump($digestRequest));
                    $this->debug("certRequest=");
                    $this->appendDebug($this->varDump($certRequest));
            Severity: Minor
            Found in system/lib/nusoap/class.soap_transport_http.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 setCredentials has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function setCredentials($username, $password, $authtype = 'basic', $digestRequest = array(), $certRequest = array()) {
                    $this->debug("setCredentials username=$username authtype=$authtype digestRequest=");
                    $this->appendDebug($this->varDump($digestRequest));
                    $this->debug("certRequest=");
                    $this->appendDebug($this->varDump($certRequest));
            Severity: Minor
            Found in system/lib/nusoap/class.soap_transport_http.php - About 1 hr to fix

              Method getCookiesForRequest has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function getCookiesForRequest($cookies, $secure=false) {
                      $cookie_str = '';
                      if ((! is_null($cookies)) && (is_array($cookies))) {
                          foreach ($cookies as $cookie) {
                              if (! is_array($cookie)) {
              Severity: Minor
              Found in system/lib/nusoap/class.soap_transport_http.php - About 1 hr to fix

                Method sendRequest has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function sendRequest($data, $cookies = NULL) {
                        // build cookie string
                        $cookie_str = $this->getCookiesForRequest($cookies, (($this->scheme == 'ssl') || ($this->scheme == 'https')));
                
                        // build payload
                Severity: Minor
                Found in system/lib/nusoap/class.soap_transport_http.php - About 1 hr to fix

                  Method decodeChunked has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function decodeChunked($buffer, $lb){
                          // length := 0
                          $length = 0;
                          $new = '';
                          
                  Severity: Minor
                  Found in system/lib/nusoap/class.soap_transport_http.php - About 1 hr to fix

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

                        function setURL($url) {
                            $this->url = $url;
                    
                            $u = parse_url($url);
                            foreach($u as $k => $v){
                    Severity: Minor
                    Found in system/lib/nusoap/class.soap_transport_http.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 send has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) {
                            
                            $this->debug('entered send() with data of length: '.strlen($data));
                    
                            $this->tryagain = true;
                    Severity: Minor
                    Found in system/lib/nusoap/class.soap_transport_http.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 setURL has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function setURL($url) {
                            $this->url = $url;
                    
                            $u = parse_url($url);
                            foreach($u as $k => $v){
                    Severity: Minor
                    Found in system/lib/nusoap/class.soap_transport_http.php - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if ($this->use_curl || ($this->scheme == 'https') || ($this->scheme == 'http' && $this->authtype == 'ntlm') || ($this->scheme == 'http' && is_array($this->proxy) && $this->proxy['authtype'] == 'ntlm'))
                                  return 'curl';
                      Severity: Major
                      Found in system/lib/nusoap/class.soap_transport_http.php - About 1 hr to fix

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

                            function parseCookie($cookie_str) {
                                $cookie_str = str_replace('; ', ';', $cookie_str) . ';';
                                $data = preg_split('/;/', $cookie_str);
                                $value_str = $data[0];
                        
                        
                        Severity: Minor
                        Found in system/lib/nusoap/class.soap_transport_http.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

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

                            function io_method() {
                                if ($this->use_curl || ($this->scheme == 'https') || ($this->scheme == 'http' && $this->authtype == 'ntlm') || ($this->scheme == 'http' && is_array($this->proxy) && $this->proxy['authtype'] == 'ntlm'))
                                    return 'curl';
                                if (($this->scheme == 'http' || $this->scheme == 'ssl') && $this->authtype != 'ntlm' && (!is_array($this->proxy) || $this->proxy['authtype'] != 'ntlm'))
                                    return 'socket';
                        Severity: Minor
                        Found in system/lib/nusoap/class.soap_transport_http.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

                        Function decodeChunked has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            function decodeChunked($buffer, $lb){
                                // length := 0
                                $length = 0;
                                $new = '';
                                
                        Severity: Minor
                        Found in system/lib/nusoap/class.soap_transport_http.php - About 45 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

                        Consider simplifying this complex logical expression.
                        Open

                                if (
                                    ($http_status >= 300 && $http_status <= 307) ||
                                    ($http_status >= 400 && $http_status <= 417) ||
                                    ($http_status >= 501 && $http_status <= 505)
                                   ) {
                        Severity: Major
                        Found in system/lib/nusoap/class.soap_transport_http.php - About 40 mins to fix

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

                              function setCredentials($username, $password, $authtype = 'basic', $digestRequest = array(), $certRequest = array()) {
                          Severity: Minor
                          Found in system/lib/nusoap/class.soap_transport_http.php - About 35 mins to fix

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

                                function setProxy($proxyhost, $proxyport, $proxyusername = '', $proxypassword = '', $proxyauthtype = 'basic') {
                            Severity: Minor
                            Found in system/lib/nusoap/class.soap_transport_http.php - About 35 mins to fix

                              Avoid too many return statements within this method.
                              Open

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

                                Avoid too many return statements within this method.
                                Open

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

                                  Avoid too many return statements within this method.
                                  Open

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

                                    Avoid too many return statements within this method.
                                    Open

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

                                      Avoid too many return statements within this method.
                                      Open

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

                                        Avoid too many return statements within this method.
                                        Open

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

                                          Avoid too many return statements within this method.
                                          Open

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

                                            Avoid too many return statements within this method.
                                            Open

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

                                              Avoid too many return statements within this method.
                                              Open

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

                                                Avoid too many return statements within this method.
                                                Open

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

                                                  Avoid too many return statements within this method.
                                                  Open

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

                                                    Avoid too many return statements within this method.
                                                    Open

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

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

                                                      class soap_transport_http extends nusoap_base {
                                                      
                                                          var $url = '';
                                                          var $uri = '';
                                                          var $digest_uri = '';
                                                      Severity: Major
                                                      Found in system/lib/nusoap/class.soap_transport_http.php and 1 other location - About 2 mos to fix
                                                      system/lib/nusoap/nusoap.php on lines 2169..3458

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

                                                      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