serp-spider/http-client-curl

View on GitHub

Showing 8 of 8 total issues

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

    public function sendRequest(
        RequestInterface $request,
        ProxyInterface $proxy = null,
        CookieJarInterface $cookieJar = null
    ) {
Severity: Minor
Found in src/CurlClient.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 sendRequest has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function sendRequest(
        RequestInterface $request,
        ProxyInterface $proxy = null,
        CookieJarInterface $cookieJar = null
    ) {
Severity: Major
Found in src/CurlClient.php - About 2 hrs to fix

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

        public static function buildResponse(
            $rawResponse,
            $headerSize,
            UrlArchive $initialUrl,
            UrlArchive $effectiveUrl,
    Severity: Minor
    Found in src/CurlClient/ResponseBuilder.php - About 1 hr to fix

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

          private function createRequestOptions(RequestInterface $request)
          {
              // DEFAULT
              $options = $this->options;
              $options[CURLOPT_HEADER] = true;
      Severity: Minor
      Found in src/CurlClient/Curl.php - About 1 hr to fix

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

            public static function parseHeaders(array $headers, &$data)
            {
        
                $statusLine = trim(array_shift($headers));
                $parts = explode(' ', $statusLine, 3);
        Severity: Minor
        Found in src/CurlClient/ResponseBuilder.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 createRequestOptions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            private function createRequestOptions(RequestInterface $request)
            {
                // DEFAULT
                $options = $this->options;
                $options[CURLOPT_HEADER] = true;
        Severity: Minor
        Found in src/CurlClient/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

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

                $rawResponse,
                $headerSize,
                UrlArchive $initialUrl,
                UrlArchive $effectiveUrl,
                ProxyInterface $proxy = null
        Severity: Minor
        Found in src/CurlClient/ResponseBuilder.php - About 35 mins to fix

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

              public static function parse($fileData)
              {
                  $cookies = [];
          
                  $fileData = preg_split('/$\R?^/m', $fileData);
          Severity: Minor
          Found in src/CurlClient/CookieFile.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

          Severity
          Category
          Status
          Source
          Language