atelierspierrot/library

View on GitHub
src/Library/HttpFundamental/Request.php

Summary

Maintainability
D
2 days
Test Coverage

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

class Request
    implements RequestInterface
{

    /**
Severity: Minor
Found in src/Library/HttpFundamental/Request.php - About 6 hrs to fix

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

    <?php
    /**
     * This file is part of the Library package.
     *
     * Copyleft (ↄ) 2013-2016 Pierre Cassat <me@e-piwi.fr> and contributors
    Severity: Minor
    Found in src/Library/HttpFundamental/Request.php - About 5 hrs to fix

      Function buildUrl has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function buildUrl()
          {
              $url = UrlHelper::parse($this->getUrl());
              
              $get = $this->getArguments();
      Severity: Minor
      Found in src/Library/HttpFundamental/Request.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 _extractSegments has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function _extractSegments(&$arguments)
          {
              if (is_string($arguments)) $this->_extractArguments($arguments);
              foreach ($arguments as $var=>$val) {
                  if (empty($val) && strpos($var, '/')!==false) {
      Severity: Minor
      Found in src/Library/HttpFundamental/Request.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 create has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              $url = null, $flag = self::NO_REWRITE,
              $protocol = 'http', $method = 'get', array $headers = null, 
              array $arguments = null, array $data = null, 
              array $session = null, array $files = null, array $cookies = null
      Severity: Major
      Found in src/Library/HttpFundamental/Request.php - About 1 hr to fix

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

            public function buildUrl()
            {
                $url = UrlHelper::parse($this->getUrl());
                
                $get = $this->getArguments();
        Severity: Minor
        Found in src/Library/HttpFundamental/Request.php - About 1 hr to fix

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

              public static function getallheaders()
              {
                  if (function_exists('getallheaders')) {
                      $return = getallheaders();
                  } else {
          Severity: Minor
          Found in src/Library/HttpFundamental/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

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

              public static function create(
                  $url = null, $flag = self::NO_REWRITE,
                  $protocol = 'http', $method = 'get', array $headers = null, 
                  array $arguments = null, array $data = null, 
                  array $session = null, array $files = null, array $cookies = null
          Severity: Minor
          Found in src/Library/HttpFundamental/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 getData has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function getData($param = null, $default = false, $clean = true, $clean_flags = ENT_COMPAT, $clean_encoding = 'UTF-8')
          Severity: Minor
          Found in src/Library/HttpFundamental/Request.php - About 35 mins to fix

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

                public function getArgument($param = null, $default = false, $clean = true, $clean_flags = ENT_COMPAT, $clean_encoding = 'UTF-8') 
            Severity: Minor
            Found in src/Library/HttpFundamental/Request.php - About 35 mins to fix

              There are no issues that match your filters.

              Category
              Status