symplely/http

View on GitHub

Showing 36 of 36 total issues

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

    public static function requestAllHeaders()
    {
        $headers = [];
        $copy_server = array(
            'CONTENT_TYPE' => 'Content-Type',
Severity: Minor
Found in Http/ServerRequestFactory.php - About 1 hr to fix

    Method getParsedBody has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getParsedBody()
        {
            if ($this->parsedBody || !$this->body) {
                return $this->parsedBody;
            }
    Severity: Minor
    Found in Http/ServerRequest.php - About 1 hr to fix

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

          public static function create($header)
          {
              $parts = \preg_split('~\\s*[;]\\s*~', $header);
              list($name, $value) = \explode('=', \array_shift($parts), 2);
              $cookie = new self($name);
      Severity: Minor
      Found in Http/Cookie.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

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

          public static function create(string $uri = ''): UriInterface
          {
              $obj = new self();
              if (empty($uri)) {
                  return $obj;
      Severity: Minor
      Found in Http/Uri.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

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

          protected function validateHeader(string $header, $values = []): void
          {
              if (!\preg_match('@^[a-zA-Z0-9\'`#$%&*+.^_|~!-]+$@', $header)) {
                  throw new \InvalidArgumentException(
                      \sprintf(
      Severity: Minor
      Found in Http/MessageAbstract.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 __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              $method = 'GET',
              UriInterface $uri = null,
              array $headers = [],
              array $cookies = [],
              array $serverParams = [],
      Severity: Major
      Found in Http/ServerRequest.php - About 50 mins to fix

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

            public static function normalizeQuery($query)
            {
                if ($query && (0 === \stripos($query, '?'))) {
                    $query = \substr($query, 1);
                }
        Severity: Minor
        Found in Http/MessageValidations.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 getParsedBody has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getParsedBody()
            {
                if ($this->parsedBody || !$this->body) {
                    return $this->parsedBody;
                }
        Severity: Minor
        Found in Http/ServerRequest.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 __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function __construct(string $id = '', $cacheLimiter = 'nocache', $cacheExpire = 180)
            {
                $this->cacheLimiter = empty($cacheLimiter) ? 'nocache' : $cacheLimiter;
                $this->cacheExpire = (int) $cacheExpire;
        
        
        Severity: Minor
        Found in Http/Sessions.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 create has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public static function create(StreamInterface $file, ?int $size = null, int $error = UPLOAD_ERR_OK, ?string $clientFilename = null, ?string $clientMediaType = null): UploadedFileInterface
        Severity: Minor
        Found in Http/UploadedFile.php - About 35 mins to fix

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

              public function __construct($file, $size, $error, $clientFilename = null, $clientMediaType = null)
          Severity: Minor
          Found in Http/UploadedFile.php - About 35 mins to fix

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

                public function __toString()
                {
                    $uri = '';
                    if ($this->scheme) {
                        $uri .= "{$this->scheme}://";
            Severity: Minor
            Found in Http/Uri.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 withUri has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public function withUri(UriInterface $uri, $preserveHost = false)
                {
                    $clone = clone $this;
                    $clone->uri = $uri;
                    if ($preserveHost) {
            Severity: Minor
            Found in Http/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

            Avoid too many return statements within this method.
            Open

                            return $response;
            Severity: Major
            Found in Http/Sessions.php - About 30 mins to fix

              Function getRequestTarget has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getRequestTarget()
                  {
                      if ($this->requestTarget) {
                          return $this->requestTarget;
                      }
              Severity: Minor
              Found in Http/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 __toString has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function __toString()
                  {
                      $params = array($this->name . '=' . \urlencode($this->value));
                      if ($this->domain) {
                          $params[] = "Domain={$this->domain}";
              Severity: Minor
              Found in Http/Cookie.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

              Severity
              Category
              Status
              Source
              Language