themichaelhall/datatypes

View on GitHub

Showing 36 of 40 total issues

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

    private static function parseParts(array $parts, bool $parseAsDirectory, bool &$isAbsolute, array &$directoryParts, ?string &$filename, ?string &$error): bool
Severity: Minor
Found in src/System/FilePath.php - About 45 mins to fix

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

        private function __construct(bool $isAbsolute, int $aboveBaseLevel, ?string $drive, array $directoryParts, ?string $filename)
    Severity: Minor
    Found in src/System/FilePath.php - About 35 mins to fix

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

          private static function validateParts(int $port, UrlPathInterface $path, ?string $queryString, ?string $fragment, ?string &$error): bool
      Severity: Minor
      Found in src/Net/Url.php - About 35 mins to fix

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

            private static function parsePath(string $pathString, ?UrlPathInterface &$path, ?string &$queryString, ?string &$fragment, ?string &$error = null): bool
        Severity: Minor
        Found in src/Net/Url.php - About 35 mins to fix

          Avoid too many return statements within this method.
          Open

                  return true;
          Severity: Major
          Found in src/Net/Hostname.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return true;
            Severity: Major
            Found in src/Net/Url.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return new self($domainParts, $tld);
              Severity: Major
              Found in src/Net/Hostname.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return new self($scheme, $host, $port, $path, $queryString, $fragment);
                Severity: Major
                Found in src/Net/Url.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return true;
                  Severity: Major
                  Found in src/Net/EmailAddress.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return false;
                    Severity: Major
                    Found in src/Net/Hostname.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return new self($isAbsolute, $aboveBaseLevel, $drive, $directoryParts, $filename);
                      Severity: Major
                      Found in src/System/FilePath.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return true;
                        Severity: Major
                        Found in src/Net/Url.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                  return true;
                          Severity: Major
                          Found in src/Net/Hostname.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                    return new self($username, $host);
                            Severity: Major
                            Found in src/Net/EmailAddress.php - About 30 mins to fix

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

                                  private static function doParse(?UrlInterface $baseUrl, string $str, ?string &$error = null): ?self
                                  {
                                      if ($baseUrl === null && $str === '') {
                                          $error = 'Url "" is empty.';
                              
                              
                              Severity: Minor
                              Found in src/Net/Url.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 validateOctets has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private static function validateOctets(array $octets, ?string &$error): bool
                                  {
                                      if (count($octets) !== 4) {
                                          $error = 'IP address must consist of four octets.';
                              
                              
                              Severity: Minor
                              Found in src/Net/IPAddress.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