atmonshi/sender

View on GitHub
src/STag/CURL.php

Summary

Maintainability
F
3 days
Test Coverage

File CURL.php has 487 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace atmonshi\sender\STag;

class CURL
Severity: Minor
Found in src/STag/CURL.php - About 7 hrs to fix

    CURL has 38 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class CURL
    {
        const VERSION = '2.1.0';
    
        private $cookies = [];
    Severity: Minor
    Found in src/STag/CURL.php - About 5 hrs to fix

      Function get has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          public function get($url_mixed, $data = [])
          {
              if (is_array($url_mixed)) {
                  $curl_multi = curl_multi_init();
                  $this->multi_parent = true;
      Severity: Minor
      Found in src/STag/CURL.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

      Function parseResponse has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          private function parseResponse($response)
          {
              $response_headers = '';
              $raw_response = $response;
              if (!(strpos($response, "\r\n\r\n") === false)) {
      Severity: Minor
      Found in src/STag/CURL.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 postfields has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          private function postfields($data)
          {
              if (is_array($data)) {
                  if (self::is_array_multidim($data)) {
                      $data = self::http_build_multi_query($data);
      Severity: Minor
      Found in src/STag/CURL.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

      Method get has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function get($url_mixed, $data = [])
          {
              if (is_array($url_mixed)) {
                  $curl_multi = curl_multi_init();
                  $this->multi_parent = true;
      Severity: Minor
      Found in src/STag/CURL.php - About 1 hr to fix

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

            private function parseResponse($response)
            {
                $response_headers = '';
                $raw_response = $response;
                if (!(strpos($response, "\r\n\r\n") === false)) {
        Severity: Minor
        Found in src/STag/CURL.php - About 1 hr to fix

          Method exec has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function exec($_ch = null)
              {
                  $ch = $_ch === null ? $this : $_ch;
          
                  if ($ch->multi_child) {
          Severity: Minor
          Found in src/STag/CURL.php - About 1 hr to fix

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

                protected function exec($_ch = null)
                {
                    $ch = $_ch === null ? $this : $_ch;
            
                    if ($ch->multi_child) {
            Severity: Minor
            Found in src/STag/CURL.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 http_build_multi_query has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function http_build_multi_query($data, $key = null)
                {
                    $query = [];
            
                    if (empty($data)) {
            Severity: Minor
            Found in src/STag/CURL.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