PromisePay/promisepay-php

View on GitHub
lib/Vendors/Httpful/Request.php

Summary

Maintainability
F
4 days
Test Coverage

Request has 77 functions (exceeds 20 allowed). Consider refactoring.
Open

class Request
{

    // Option constants
    const SERIALIZE_PAYLOAD_NEVER   = 0;
Severity: Major
Found in lib/Vendors/Httpful/Request.php - About 1 day to fix

    File Request.php has 583 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Httpful;
    
    use Httpful\Exception\ConnectionErrorException;
    Severity: Major
    Found in lib/Vendors/Httpful/Request.php - About 1 day to fix

      Function _curlPrep has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          public function _curlPrep()
          {
              // Check for required stuff
              if (!isset($this->uri))
                  throw new \Exception('Attempting to send a request before defining a URI endpoint.');
      Severity: Minor
      Found in lib/Vendors/Httpful/Request.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

      Method _curlPrep has 85 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function _curlPrep()
          {
              // Check for required stuff
              if (!isset($this->uri))
                  throw new \Exception('Attempting to send a request before defining a URI endpoint.');
      Severity: Major
      Found in lib/Vendors/Httpful/Request.php - About 3 hrs to fix

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

            public function buildUserAgent()
            {
                $user_agent = 'User-Agent: Httpful/' . Httpful::VERSION . ' (cURL/';
                $curl = \curl_version();
        
        
        Severity: Minor
        Found in lib/Vendors/Httpful/Request.php - About 55 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method useProxy has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function useProxy($proxy_host, $proxy_port = 80, $auth_type = null, $auth_username = null, $auth_password = null, $proxy_type = Proxy::HTTP)
        Severity: Minor
        Found in lib/Vendors/Httpful/Request.php - About 45 mins to fix

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

              public function __call($method, $args)
              {
                  // This method supports the sends* methods
                  // like sendsJSON, sendsForm
                  //!method_exists($this, $method) &&
          Severity: Minor
          Found in lib/Vendors/Httpful/Request.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

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

              public function useSocks5Proxy($proxy_host, $proxy_port = 80, $auth_type = null, $auth_username = null, $auth_password = null)
          Severity: Minor
          Found in lib/Vendors/Httpful/Request.php - About 35 mins to fix

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

                public function useSocks4Proxy($proxy_host, $proxy_port = 80, $auth_type = null, $auth_username = null, $auth_password = null)
            Severity: Minor
            Found in lib/Vendors/Httpful/Request.php - About 35 mins to fix

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

                  public function attach($files)
                  {
                      $finfo = finfo_open(FILEINFO_MIME_TYPE);
                      foreach ($files as $key => $file) {
                          $mimeType = finfo_file($finfo, $file);
              Severity: Minor
              Found in lib/Vendors/Httpful/Request.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 _serializePayload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function _serializePayload($payload)
                  {
                      if (empty($payload) || $this->serialize_payload_method === self::SERIALIZE_PAYLOAD_NEVER)
                          return $payload;
              
              
              Severity: Minor
              Found in lib/Vendors/Httpful/Request.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 send has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function send()
                  {
              
                      if (!$this->hasBeenInitialized())
                          $this->_curlPrep();
              Severity: Minor
              Found in lib/Vendors/Httpful/Request.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