dadajuice/zephyrus

View on GitHub

Showing 64 of 84 total issues

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

    private function scanRecursively(string $directory, callable $callback)
    {
        $elements = scandir($directory);
        foreach ($elements as $element) {
            if ($element != "." && $element != "..") {
Severity: Minor
Found in src/Zephyrus/Utilities/FileSystem/Directory.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 xml has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function xml(array|SimpleXMLElement|string $data, string $rootElement = ""): Response
    {
        $response = new Response(ContentType::XML);
        if (is_string($data)) {
            try {
Severity: Minor
Found in src/Zephyrus/Network/Response/XmlResponses.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 initializeBaseAuthorizationRules has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function initializeBaseAuthorizationRules(ReflectionClass $class): stdClass
    {
        $parentClasses = [];
        $currentClass = $class;
        while ($currentClass = $currentClass->getParentClass()) {
Severity: Minor
Found in src/Zephyrus/Application/Controller.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 run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(): void
    {
        if (!$this->isExempt()) {
            $providedToken = $this->getProvidedCsrfToken();
            if (is_null($providedToken)) {
Severity: Minor
Found in src/Zephyrus/Security/CsrfGuard.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 getAllRootDirectoryNames has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAllRootDirectoryNames(): array
    {
        $directories = [];
        $elements = scandir($this->path);
        foreach ($elements as $element) {
Severity: Minor
Found in src/Zephyrus/Utilities/FileSystem/Directory.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 chunks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function chunks(callable $callback, int $count = 50): void
    {
        $results = [];
        $iterator = 0;
        while ($row = $this->statement->next()) {
Severity: Minor
Found in src/Zephyrus/Database/SqlResult.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 true;
Severity: Major
Found in src/Zephyrus/Security/CsrfGuard.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return $this->afterMiddleware($controller, $response);
    Severity: Major
    Found in src/Zephyrus/Network/Router.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return false;
      Severity: Major
      Found in src/Zephyrus/Security/CsrfGuard.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return function ($value) {
                        $array = str_replace(["{", "}"], "", $value);
                        return explode(",", $array);
                    };
        Severity: Major
        Found in src/Zephyrus/Database/Core/DatabaseStatement.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return null;
          Severity: Major
          Found in src/Zephyrus/Database/Core/DatabaseStatement.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return PDO::PARAM_STR;
            Severity: Major
            Found in src/Zephyrus/Database/Core/Database.php - About 30 mins to fix

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

                  public function __construct(string $rawData, string $contentType = ContentType::FORM)
                  {
                      $this->rawData = $rawData;
                      $this->contentType = $contentType;
                      if (str_contains($contentType, ContentType::FORM)
              Severity: Minor
              Found in src/Zephyrus/Network/Request/RequestBody.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 isExempt has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function isExempt(): bool
                  {
                      if (!$this->isHttpMethodFiltered($this->request->getMethod()->value)) {
                          return true;
                      }
              Severity: Minor
              Found in src/Zephyrus/Security/CsrfGuard.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function run(array $data): IntrusionReport
                  {
                      $report = new IntrusionReport();
                      foreach ($data as $parameter => $value) {
                          if ($this->isExempt((string) $parameter)) {
              Severity: Minor
              Found in src/Zephyrus/Security/IntrusionDetection/IntrusionMonitor.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 hasCurlFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function hasCurlFile(array $payload): bool
                  {
                      foreach ($payload as $data) {
                          if (is_array($data) && $this->hasCurlFile($data)) {
                              return true;
              Severity: Minor
              Found in src/Zephyrus/Network/HttpRequester/HttpPayload.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 isHttpMethodFiltered has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function isHttpMethodFiltered(string $method): bool
                  {
                      if ($this->isGetSecured() && $method == "GET") {
                          return true;
                      } elseif ($this->isPostSecured() && $method == "POST") {
              Severity: Minor
              Found in src/Zephyrus/Security/CsrfGuard.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 send has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function send()
                  {
                      if (empty($this->accessControlAllowOrigin)) {
                          return;
                      }
              Severity: Minor
              Found in src/Zephyrus/Security/CrossOriginResourcePolicy.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 initializeGuardedMethods has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function initializeGuardedMethods(): void
                  {
                      if (isset($this->configurations['guard_methods'])) {
                          foreach ($this->configurations['guard_methods'] as $method) {
                              if (!in_array($method, ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'])) {
              Severity: Minor
              Found in src/Zephyrus/Security/CsrfGuard.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 isRefreshNeededByProbability has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function isRefreshNeededByProbability(): bool
                  {
                      if ($this->refreshMode == self::MODE_PROBABILITY) {
                          if ($this->refreshRate == 0) {
                              return false;
              Severity: Minor
              Found in src/Zephyrus/Core/Session/SessionIdentifierManager.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