Showing 24 of 24 total issues

Uri has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

class Uri implements UriInterface
{
    /**
     * Uri scheme (without "://" suffix)
     *
Severity: Minor
Found in src/Uri.php - About 2 hrs to fix

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

    class Request extends Message implements ServerRequestInterface
    {
    
        /**
         *
    Severity: Minor
    Found in src/Request.php - About 2 hrs to fix

      File Uri.php has 254 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace Pluf\Http;
      
      use InvalidArgumentException;
      Severity: Minor
      Found in src/Uri.php - About 2 hrs to fix

        Function moveTo has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            public function moveTo($targetPath): void
            {
                if ($this->moved) {
                    throw new RuntimeException('Uploaded file already moved');
                }
        Severity: Minor
        Found in src/UploadedFile.php - About 2 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 toHeader has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function toHeader(string $name, array $properties): string
            {
                $result = urlencode($name) . '=' . urlencode($properties['value']);
        
                if (isset($properties['domain'])) {
        Severity: Minor
        Found in src/Cookies.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 createFromGlobals has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            public function createFromGlobals(array $globals): Uri
            {
                // Scheme
                $https = isset($globals['HTTPS']) ? $globals['HTTPS'] : false;
                $scheme = ! $https || $https === 'off' ? 'http' : 'https';
        Severity: Minor
        Found in src/UriFactory.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 parseUploadedFiles has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            private static function parseUploadedFiles(array $uploadedFiles): array
            {
                $parsed = [];
                foreach ($uploadedFiles as $field => $uploadedFile) {
                    if (! isset($uploadedFile['error'])) {
        Severity: Minor
        Found in src/UploadedFile.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 createFromGlobals has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function createFromGlobals(array $globals): Uri
            {
                // Scheme
                $https = isset($globals['HTTPS']) ? $globals['HTTPS'] : false;
                $scheme = ! $https || $https === 'off' ? 'http' : 'https';
        Severity: Minor
        Found in src/UriFactory.php - About 1 hr to fix

          Function isReadable has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              public function isReadable(): bool
              {
                  if ($this->readable === null) {
                      if ($this->isPipe()) {
                          $this->readable = true;
          Severity: Minor
          Found in src/Stream.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 parseHeader has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function parseHeader($header): array
              {
                  if (is_array($header)) {
                      $header = isset($header[0]) ? $header[0] : '';
                  }
          Severity: Minor
          Found in src/Cookies.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 toHeader has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function toHeader(string $name, array $properties): string
              {
                  $result = urlencode($name) . '=' . urlencode($properties['value']);
          
                  if (isset($properties['domain'])) {
          Severity: Minor
          Found in src/Cookies.php - About 1 hr to fix

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

                public function moveTo($targetPath): void
                {
                    if ($this->moved) {
                        throw new RuntimeException('Uploaded file already moved');
                    }
            Severity: Minor
            Found in src/UploadedFile.php - About 1 hr to fix

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

                      string $scheme,
                      string $host,
                      ?int $port = null,
                      string $path = '/',
                      string $query = '',
              Severity: Major
              Found in src/Uri.php - About 1 hr to fix

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

                    public function __construct($method, UriInterface $uri, HeadersInterface $headers, array $cookies, array $serverParams, StreamInterface $body, array $uploadedFiles = [])
                Severity: Major
                Found in src/Request.php - About 50 mins to fix

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

                      final public function __construct($fileNameOrStream, ?string $name = null, ?string $type = null, ?int $size = null, int $error = UPLOAD_ERR_OK, bool $sapi = false)
                  Severity: Minor
                  Found in src/UploadedFile.php - About 45 mins to fix

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

                        public function getContents(): string
                        {
                            if ($this->cache && $this->finished) {
                                $this->cache->rewind();
                                return $this->cache->getContents();
                    Severity: Minor
                    Found in src/Stream.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 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/UploadedFileFactory.php - About 35 mins to fix

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

                          public function read($length): string
                          {
                              $data = false;
                      
                              if ($this->isReadable() && $this->stream) {
                      Severity: Minor
                      Found in src/Stream.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 isPipe has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function isPipe(): bool
                          {
                              if ($this->isPipe === null) {
                                  $this->isPipe = false;
                      
                      
                      Severity: Minor
                      Found in src/Stream.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 isWritable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function isWritable(): bool
                          {
                              if ($this->writable === null) {
                                  $this->writable = false;
                      
                      
                      Severity: Minor
                      Found in src/Stream.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