CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-includes/class-IXR.php

Summary

Maintainability
F
6 days
Test Coverage

File class-IXR.php has 752 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * IXR - The Inutio XML-RPC Library
 *
 * @package IXR
Severity: Major
Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 1 day to fix

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

        function call($methodname, $args) {
            // Make sure it's in an array
            if ($args && !is_array($args)) {
                $args = array($args);
            }
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.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 tag_close has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        function tag_close($parser, $tag) {
            $valueFlag = false;
            switch($tag) {
                case 'int':
                case 'i4':
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.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 query has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        function query() {
            $args = func_get_args();
            $method = array_shift($args);
            $request = new IXR_Request($method, $args);
            $length = $request->getLength();
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.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 query has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function query() {
            $args = func_get_args();
            $method = array_shift($args);
            $request = new IXR_Request($method, $args);
            $length = $request->getLength();
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 2 hrs to fix

      Method tag_close has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function tag_close($parser, $tag) {
              $valueFlag = false;
              switch($tag) {
                  case 'int':
                  case 'i4':
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 2 hrs to fix

        Method call has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function call($methodname, $args) {
                // Make sure it's in an array
                if ($args && !is_array($args)) {
                    $args = array($args);
                }
        Severity: Major
        Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 2 hrs to fix

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

              function call($methodname, $args) {
                  if (!$this->hasMethod($methodname)) {
                      return new IXR_Error(-32601, 'server error. requested method '.
                          $methodname.' does not exist.');
                  }
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.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 getXml has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function getXml() {
                  /* Return XML for this value */
                  switch ($this->type) {
                      case 'boolean':
                          return '<boolean>'.(($this->data) ? '1' : '0').'</boolean>';
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 1 hr to fix

            Method methodSignature has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function methodSignature($method) {
                    if (!$this->hasMethod($method)) {
                        return new IXR_Error(-32601, 'server error. requested method "'.$method.'" not specified.');
                    }
                    // We should be returning an array of types
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 1 hr to fix

              Method serve has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function serve($data = false) {
                      if (!$data) {
                          global $HTTP_RAW_POST_DATA;
                          if (!$HTTP_RAW_POST_DATA) {
                             header( 'Content-Type: text/plain' );
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 1 hr to fix

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

                    function methodSignature($method) {
                        if (!$this->hasMethod($method)) {
                            return new IXR_Error(-32601, 'server error. requested method "'.$method.'" not specified.');
                        }
                        // We should be returning an array of types
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.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 calculateType has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    function calculateType() {
                        if ($this->data === true || $this->data === false) {
                            return 'boolean';
                        }
                        if (is_integer($this->data)) {
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.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 IXR_IntrospectionServer has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function IXR_IntrospectionServer() {
                        $this->setCallbacks();
                        $this->setCapabilities();
                        $this->capabilities['introspection'] = array(
                            'specUrl' => 'http://xmlrpc.usefulinc.com/doc/reserved.html',
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 1 hr to fix

                  Method call has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function call($methodname, $args) {
                          if (!$this->hasMethod($methodname)) {
                              return new IXR_Error(-32601, 'server error. requested method '.
                                  $methodname.' does not exist.');
                          }
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 1 hr to fix

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

                        function getXml() {
                            /* Return XML for this value */
                            switch ($this->type) {
                                case 'boolean':
                                    return '<boolean>'.(($this->data) ? '1' : '0').'</boolean>';
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.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 parse has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function parse() {
                            // first remove the XML declaration
                            // this method avoids the RAM usage of preg_replace on very large messages
                            $header = preg_replace( '/<\?xml.*?\?'.'>/', '', substr( $this->message, 0, 100 ), 1 );
                            $this->message = substr_replace($this->message, $header, 0, 100);
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 1 hr to fix

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

                          function calculateType() {
                              if ($this->data === true || $this->data === false) {
                                  return 'boolean';
                              }
                              if (is_integer($this->data)) {
                      Severity: Minor
                      Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 1 hr to fix

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

                            function multiCall($methodcalls) {
                                // See http://www.xmlrpc.com/discuss/msgReader$1208
                                $return = array();
                                foreach ($methodcalls as $call) {
                                    $method = $call['methodName'];
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.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 IXR_Value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            function IXR_Value ($data, $type = false) {
                                $this->data = $data;
                                if (!$type) {
                                    $type = $this->calculateType();
                                }
                        Severity: Minor
                        Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.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 $return;
                        Severity: Major
                        Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                  return true;
                          Severity: Major
                          Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return 'struct';
                            Severity: Major
                            Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                      return false;
                              Severity: Major
                              Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                return $this->data->getXml();
                                Severity: Major
                                Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                  return $return;
                                  Severity: Major
                                  Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                return 'base64';
                                    Severity: Major
                                    Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                  return 'struct';
                                      Severity: Major
                                      Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                    return 'string';
                                        Severity: Major
                                        Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                  return $result;
                                          Severity: Major
                                          Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                        return 'array';
                                            Severity: Major
                                            Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.php - About 30 mins to fix

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

                                                  function parse() {
                                                      // first remove the XML declaration
                                                      // this method avoids the RAM usage of preg_replace on very large messages
                                                      $header = preg_replace( '/<\?xml.*?\?'.'>/', '', substr( $this->message, 0, 100 ), 1 );
                                                      $this->message = substr_replace($this->message, $header, 0, 100);
                                              Severity: Minor
                                              Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.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 serve has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  function serve($data = false) {
                                                      if (!$data) {
                                                          global $HTTP_RAW_POST_DATA;
                                                          if (!$HTTP_RAW_POST_DATA) {
                                                             header( 'Content-Type: text/plain' );
                                              Severity: Minor
                                              Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.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

                                              There are no issues that match your filters.

                                              Category
                                              Status