modxcms/revolution

View on GitHub
core/model/aws/lib/requestcore/requestcore.class.php

Summary

Maintainability
F
3 days
Test Coverage

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

<?php
/**
 * Handles all HTTP requests using cURL and manages the responses.
 *
 * @version 2011.06.07
Severity: Minor
Found in core/model/aws/lib/requestcore/requestcore.class.php - About 7 hrs to fix

    Method prep_request has 115 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function prep_request()
        {
            $curl_handle = curl_init();
    
            // Set default options.
    Severity: Major
    Found in core/model/aws/lib/requestcore/requestcore.class.php - About 4 hrs to fix

      Function prep_request has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

          public function prep_request()
          {
              $curl_handle = curl_init();
      
              // Set default options.
      Severity: Minor
      Found in core/model/aws/lib/requestcore/requestcore.class.php - About 4 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

      RequestCore has 28 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class RequestCore
      {
          /**
           * The URL being requested.
           */
      Severity: Minor
      Found in core/model/aws/lib/requestcore/requestcore.class.php - About 3 hrs to fix

        Function send_multi_request has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            public function send_multi_request($handles, $opt = null)
            {
                set_time_limit(0);
        
                // Skip everything if there are no handles to process.
        Severity: Minor
        Found in core/model/aws/lib/requestcore/requestcore.class.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 send_multi_request has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function send_multi_request($handles, $opt = null)
            {
                set_time_limit(0);
        
                // Skip everything if there are no handles to process.
        Severity: Major
        Found in core/model/aws/lib/requestcore/requestcore.class.php - About 2 hrs to fix

          Method process_response has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function process_response($curl_handle = null, $response = null)
              {
                  // Accept a custom one if it's passed.
                  if ($curl_handle && $response)
                  {
          Severity: Minor
          Found in core/model/aws/lib/requestcore/requestcore.class.php - About 1 hr to fix

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

                public function set_read_stream($resource, $size = null)
                {
                    if (!isset($size) || $size < 0)
                    {
                        $stats = fstat($resource);
            Severity: Minor
            Found in core/model/aws/lib/requestcore/requestcore.class.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

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

                public function process_response($curl_handle = null, $response = null)
                {
                    // Accept a custom one if it's passed.
                    if ($curl_handle && $response)
                    {
            Severity: Minor
            Found in core/model/aws/lib/requestcore/requestcore.class.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 streaming_read_callback has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function streaming_read_callback($curl_handle, $file_handle, $length)
                {
                    // Once we've sent as much as we're supposed to send...
                    if ($this->read_stream_read >= $this->read_stream_size)
                    {
            Severity: Minor
            Found in core/model/aws/lib/requestcore/requestcore.class.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