Furious-PHP/psr7

View on GitHub

Showing 14 of 16 total issues

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

        string $method, $uri, string $version = '1.1', array $headers = [],
        array $queryParams = [], $body = null,
        array $serverParams = [], array $cookieParams = [],
        array $files = [], array $attributes = []
Severity: Major
Found in src/ServerRequest.php - About 1 hr to fix

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

        public function __construct($xml, int $statusCode = 200, array $headers = [], $body = null, string $version = '1.1', string $reason = null)
    Severity: Minor
    Found in src/Response/XmlResponse.php - About 45 mins to fix

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

          public function __construct(string $text, int $statusCode = 200, array $headers = [], $body = null, string $version = '1.1', string $reason = null)
      Severity: Minor
      Found in src/Response/TextResponse.php - About 45 mins to fix

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

            public function __construct($uri, int $statusCode = 302, array $headers = [], $body = null, string $version = '1.1', string $reason = null)
        Severity: Minor
        Found in src/Response/RedirectResponse.php - About 45 mins to fix

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

              public function __construct(array $data, int $statusCode = 200, array $headers = [], $body = null, string $version = '1.1', string $reason = null)
          Severity: Minor
          Found in src/Response/JsonResponse.php - About 45 mins to fix

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

                public function __construct(string $html, int $statusCode = 200, array $headers = [], $body = null, string $version = '1.1', string $reason = null)
            Severity: Minor
            Found in src/Response/HtmlResponse.php - About 45 mins to fix

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

                  public function  __construct(string $method, $uri, array $headers = [], $body = null, string $version = '1.1')
              Severity: Minor
              Found in src/Request.php - About 35 mins to fix

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

                        StreamInterface $stream, ?int $size = null, int $error = UPLOAD_ERR_OK,
                        string $clientFilename = null, string $clientMediaType = null
                Severity: Minor
                Found in src/Factory/UploadedFileFactory.php - About 35 mins to fix

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

                          $streamOrFile, ?int $size, int $error,
                          string $clientFileName = null, string $clientMediaType = null
                  Severity: Minor
                  Found in src/UploadedFile.php - About 35 mins to fix

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

                            int $statusCode = 200, array $headers = [], $body = null,
                            string $version = '1.1', string $reason = null
                    Severity: Minor
                    Found in src/Response.php - About 35 mins to fix

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

                          public function __construct(int $offset, int $whence, $message = '', $code = 0, Throwable $previous = null)
                      Severity: Minor
                      Found in src/Exception/UnableToSeekException.php - About 35 mins to fix

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

                            private function buildPathByAuthority(string $path, string $authority): string
                            {
                                $newPath = $path;
                        
                                if ('/' !== $path[0]) {
                        Severity: Minor
                        Found in src/Builder/UriBuilder.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 setHeaders has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function setHeaders(array $headers): void
                            {
                                foreach ($headers as $header => $value) {
                                    if (is_integer($header)) {
                                        $header = (string) $header;
                        Severity: Minor
                        Found in src/Message.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 get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function get(): array
                            {
                                $headers = [];
                                foreach ($this->serverParameters as $key => $value) {
                                    if (!is_string($key) or $value === '') {
                        Severity: Minor
                        Found in src/Header/HeadersCollection.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