CaffGeek/MBACNationals

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

Summary

Maintainability
F
1 wk
Test Coverage

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

<?php
/**
 * Simple and uniform HTTP request API.
 *
 * Standardizes the HTTP requests for WordPress. Handles cookies, gzip encoding and decoding, chunk
Severity: Major
Found in Web.Admin/2014/wordpress/wp-includes/class-http.php - About 2 days to fix

    Function request has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
    Open

        function request($url, $args = array()) {
            $defaults = array(
                'method' => 'GET', 'timeout' => 5,
                'redirection' => 5, 'httpversion' => '1.0',
                'blocking' => true,
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/class-http.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 request has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
    Open

        function request($url, $args = array()) {
            $defaults = array(
                'method' => 'GET', 'timeout' => 5,
                'redirection' => 5, 'httpversion' => '1.0',
                'blocking' => true,
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/class-http.php - About 7 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 request has 185 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function request($url, $args = array()) {
            $defaults = array(
                'method' => 'GET', 'timeout' => 5,
                'redirection' => 5, 'httpversion' => '1.0',
                'blocking' => true,
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-includes/class-http.php - About 7 hrs to fix

      Function request has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
      Open

          function request( $url, $args = array() ) {
              global $wp_version;
      
              $defaults = array(
                  'method' => 'GET',
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/class-http.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

      Method request has 145 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function request($url, $args = array()) {
              $defaults = array(
                  'method' => 'GET', 'timeout' => 5,
                  'redirection' => 5, 'httpversion' => '1.0',
                  'blocking' => true,
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-includes/class-http.php - About 5 hrs to fix

        Method request has 98 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function request( $url, $args = array() ) {
                global $wp_version;
        
                $defaults = array(
                    'method' => 'GET',
        Severity: Major
        Found in Web.Admin/2014/wordpress/wp-includes/class-http.php - About 3 hrs to fix

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

              function __construct( $data, $requested_url = '' ) {
                  if ( $requested_url )
                      $arrURL = @parse_url( $requested_url );
                  if ( isset( $arrURL['host'] ) )
                      $this->domain = $arrURL['host'];
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/class-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

          Function processHeaders has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function processHeaders( $headers, $url = '' ) {
                  // split headers, one per array element
                  if ( is_string($headers) ) {
                      // tolerate line terminator: CRLF = LF (RFC 2616 19.3)
                      $headers = str_replace("\r\n", "\n", $headers);
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/class-http.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 compatible_gzinflate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function compatible_gzinflate($gzData) {
          
                  // Compressed data might contain a full header, if so strip it for gzinflate()
                  if ( substr($gzData, 0, 3) == "\x1f\x8b\x08" ) {
                      $i = 10;
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/class-http.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 handle_redirects has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              static function handle_redirects( $url, $args, $response ) {
                  // If no redirects are present, or, redirects were not requested, perform no action.
                  if ( ! isset( $response['headers']['location'] ) || 0 === $args['_redirection'] )
                      return false;
          
          
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/class-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 block_request has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              function block_request($uri) {
                  // We don't need to block requests, because nothing is blocked.
                  if ( ! defined( 'WP_HTTP_BLOCK_EXTERNAL' ) || ! WP_HTTP_BLOCK_EXTERNAL )
                      return false;
          
          
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/class-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_through_proxy has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              function send_through_proxy( $uri ) {
                  // parse_url() only handles http, https type URLs, and will emit E_WARNING on failure.
                  // This will be displayed on blogs, which is not reasonable.
                  $check = @parse_url($uri);
          
          
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/class-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 processHeaders has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function processHeaders( $headers, $url = '' ) {
                  // split headers, one per array element
                  if ( is_string($headers) ) {
                      // tolerate line terminator: CRLF = LF (RFC 2616 19.3)
                      $headers = str_replace("\r\n", "\n", $headers);
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/class-http.php - About 1 hr to fix

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

                function __construct( $data, $requested_url = '' ) {
                    if ( $requested_url )
                        $arrURL = @parse_url( $requested_url );
                    if ( isset( $arrURL['host'] ) )
                        $this->domain = $arrURL['host'];
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/class-http.php - About 1 hr to fix

              Function verify_ssl_certificate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  static function verify_ssl_certificate( $stream, $host ) {
                      $context_options = stream_context_get_options( $stream );
              
                      if ( empty( $context_options['ssl']['peer_certificate'] ) )
                          return false;
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/class-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 make_absolute_url has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  static function make_absolute_url( $maybe_relative_path, $url ) {
                      if ( empty( $url ) )
                          return $maybe_relative_path;
              
                      // Check for a scheme
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/class-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 accept_encoding has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function accept_encoding( $url, $args ) {
                      $type = array();
                      $compression_enabled = WP_Http_Encoding::is_available();
              
                      if ( ! $args['decompress'] ) // decompression specifically disabled
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/class-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 block_request has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function block_request($uri) {
                      // We don't need to block requests, because nothing is blocked.
                      if ( ! defined( 'WP_HTTP_BLOCK_EXTERNAL' ) || ! WP_HTTP_BLOCK_EXTERNAL )
                          return false;
              
              
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/class-http.php - About 1 hr to fix

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

                    function send_through_proxy( $uri ) {
                        // parse_url() only handles http, https type URLs, and will emit E_WARNING on failure.
                        // This will be displayed on blogs, which is not reasonable.
                        $check = @parse_url($uri);
                
                
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-includes/class-http.php - About 1 hr to fix

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

                      public static function buildCookieHeader( &$r ) {
                          if ( ! empty($r['cookies']) ) {
                              // Upgrade any name => value cookie pairs to WP_HTTP_Cookie instances
                              foreach ( $r['cookies'] as $name => $value ) {
                                  if ( ! is_object( $value ) )
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-includes/class-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 ( $r['stream'] ) {
                              if ( ! WP_DEBUG )
                                  $stream_handle = @fopen( $r['filename'], 'w+' );
                              else
                                  $stream_handle = fopen( $r['filename'], 'w+' );
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-includes/class-http.php - About 40 mins to fix

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

                        public static function decompress( $compressed, $length = null ) {
                    
                            if ( empty($compressed) )
                                return $compressed;
                    
                    
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-includes/class-http.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 chunkTransferDecode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function chunkTransferDecode( $body ) {
                            // The body is not chunked encoded or is malformed.
                            if ( ! preg_match( '/^([0-9a-f]+)[^\r\n]*\r\n/i', trim( $body ) ) )
                                return $body;
                    
                    
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-includes/class-http.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 test has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        function test( $url ) {
                            if ( is_null( $this->name ) )
                                return false;
                    
                            // Expires - if expired then nothing else matters
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-includes/class-http.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 test has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function test( $args = array() ) {
                            if ( ! function_exists( 'stream_socket_client' ) )
                                return false;
                    
                            $is_ssl = isset( $args['ssl'] ) && $args['ssl'];
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-includes/class-http.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 should_decode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function should_decode($headers) {
                            if ( is_array( $headers ) ) {
                                if ( array_key_exists('content-encoding', $headers) && ! empty( $headers['content-encoding'] ) )
                                    return true;
                            } else if ( is_string( $headers ) ) {
                    Severity: Minor
                    Found in Web.Admin/2014/wordpress/wp-includes/class-http.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 !preg_match($wildcard_regex, $check['host']);
                    Severity: Major
                    Found in Web.Admin/2014/wordpress/wp-includes/class-http.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return new WP_Error( 'http_request_failed', __( 'Too many redirects.' ) );
                      Severity: Major
                      Found in Web.Admin/2014/wordpress/wp-includes/class-http.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return !preg_match($wildcard_regex, $check['host']);
                        Severity: Major
                        Found in Web.Admin/2014/wordpress/wp-includes/class-http.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                              return new WP_Error( 'http_request_failed', __( 'Failed to write request to temporary file.' ) );
                          Severity: Major
                          Found in Web.Admin/2014/wordpress/wp-includes/class-http.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                            return new WP_Error( 'http_request_failed', sprintf( __( 'Could not open handle for fopen() to %s' ), $r['filename'] ) );
                            Severity: Major
                            Found in Web.Admin/2014/wordpress/wp-includes/class-http.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

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

                                Avoid too many return statements within this method.
                                Open

                                                return new WP_Error( 'http_request_failed', __( 'Failed to write request to temporary file.' ) );
                                Severity: Major
                                Found in Web.Admin/2014/wordpress/wp-includes/class-http.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                          return in_array( strtolower( $wildcard_host ), $certificate_hostnames );
                                  Severity: Major
                                  Found in Web.Admin/2014/wordpress/wp-includes/class-http.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

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

                                      Avoid too many return statements within this method.
                                      Open

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

                                        Avoid too many return statements within this method.
                                        Open

                                                return $absolute_path . '/' . ltrim( $path, '/' );
                                        Severity: Major
                                        Found in Web.Admin/2014/wordpress/wp-includes/class-http.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

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

                                            Avoid too many return statements within this method.
                                            Open

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

                                              Avoid too many return statements within this method.
                                              Open

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

                                                Avoid too many return statements within this method.
                                                Open

                                                            return !in_array( $check['host'], $bypass_hosts );
                                                Severity: Major
                                                Found in Web.Admin/2014/wordpress/wp-includes/class-http.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

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

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                return !in_array( $check['host'], $accessible_hosts ); //Inverse logic, If it's in the array, then we can't access it.
                                                    Severity: Major
                                                    Found in Web.Admin/2014/wordpress/wp-includes/class-http.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-http.php - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                        return new WP_Error( 'http_request_failed', $curl_error );
                                                        Severity: Major
                                                        Found in Web.Admin/2014/wordpress/wp-includes/class-http.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-http.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-http.php - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

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

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

                                                                    public static function test( $args = array() ) {
                                                                        if ( ! function_exists( 'curl_init' ) || ! function_exists( 'curl_exec' ) )
                                                                            return false;
                                                                
                                                                        $is_ssl = isset( $args['ssl'] ) && $args['ssl'];
                                                                Severity: Minor
                                                                Found in Web.Admin/2014/wordpress/wp-includes/class-http.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

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

                                                                            if ( $flg > 0 ) {
                                                                                if ( $flg & 4 ) {
                                                                                    list($xlen) = unpack('v', substr($gzData, $i, 2) );
                                                                                    $i = $i + 2 + $xlen;
                                                                                }
                                                                Severity: Major
                                                                Found in Web.Admin/2014/wordpress/wp-includes/class-http.php and 1 other location - About 3 hrs to fix
                                                                Web.Admin/2014/wordpress/wp-includes/http.php on lines 1857..1868

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

                                                                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

                                                                        if ( null == $bypass_hosts ) {
                                                                            $bypass_hosts = preg_split('|,\s*|', WP_PROXY_BYPASS_HOSTS);
                                                                
                                                                            if ( false !== strpos(WP_PROXY_BYPASS_HOSTS, '*') ) {
                                                                                $wildcard_regex = array();
                                                                Severity: Major
                                                                Found in Web.Admin/2014/wordpress/wp-includes/class-http.php and 1 other location - About 2 hrs to fix
                                                                Web.Admin/2014/wordpress/wp-includes/class-http.php on lines 623..632

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

                                                                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

                                                                        if ( null == $accessible_hosts ) {
                                                                            $accessible_hosts = preg_split('|,\s*|', WP_ACCESSIBLE_HOSTS);
                                                                
                                                                            if ( false !== strpos(WP_ACCESSIBLE_HOSTS, '*') ) {
                                                                                $wildcard_regex = array();
                                                                Severity: Major
                                                                Found in Web.Admin/2014/wordpress/wp-includes/class-http.php and 1 other location - About 2 hrs to fix
                                                                Web.Admin/2014/wordpress/wp-includes/class-http.php on lines 1691..1700

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

                                                                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 static function should_decode($headers) {
                                                                        if ( is_array( $headers ) ) {
                                                                            if ( array_key_exists('content-encoding', $headers) && ! empty( $headers['content-encoding'] ) )
                                                                                return true;
                                                                        } else if ( is_string( $headers ) ) {
                                                                Severity: Minor
                                                                Found in Web.Admin/2014/wordpress/wp-includes/class-http.php and 1 other location - About 40 mins to fix
                                                                Web.Admin/2014/wordpress/wp-includes/http.php on lines 1915..1924

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

                                                                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

                                                                Identical blocks of code found in 6 locations. Consider refactoring.
                                                                Open

                                                                        if ( isset($r['headers']['User-Agent']) ) {
                                                                            $r['user-agent'] = $r['headers']['User-Agent'];
                                                                            unset($r['headers']['User-Agent']);
                                                                        } else if ( isset($r['headers']['user-agent']) ) {
                                                                            $r['user-agent'] = $r['headers']['user-agent'];
                                                                Severity: Major
                                                                Found in Web.Admin/2014/wordpress/wp-includes/class-http.php and 5 other locations - About 40 mins to fix
                                                                Web.Admin/2014/wordpress/wp-includes/class-http.php on lines 796..802
                                                                Web.Admin/2014/wordpress/wp-includes/http.php on lines 614..620
                                                                Web.Admin/2014/wordpress/wp-includes/http.php on lines 941..947
                                                                Web.Admin/2014/wordpress/wp-includes/http.php on lines 1110..1116
                                                                Web.Admin/2014/wordpress/wp-includes/http.php on lines 1253..1259

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

                                                                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

                                                                Identical blocks of code found in 6 locations. Consider refactoring.
                                                                Open

                                                                        if ( isset($r['headers']['User-Agent']) ) {
                                                                            $r['user-agent'] = $r['headers']['User-Agent'];
                                                                            unset($r['headers']['User-Agent']);
                                                                        } else if ( isset($r['headers']['user-agent']) ) {
                                                                            $r['user-agent'] = $r['headers']['user-agent'];
                                                                Severity: Major
                                                                Found in Web.Admin/2014/wordpress/wp-includes/class-http.php and 5 other locations - About 40 mins to fix
                                                                Web.Admin/2014/wordpress/wp-includes/class-http.php on lines 1231..1237
                                                                Web.Admin/2014/wordpress/wp-includes/http.php on lines 614..620
                                                                Web.Admin/2014/wordpress/wp-includes/http.php on lines 941..947
                                                                Web.Admin/2014/wordpress/wp-includes/http.php on lines 1110..1116
                                                                Web.Admin/2014/wordpress/wp-includes/http.php on lines 1253..1259

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

                                                                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