Laragear/Alerts

View on GitHub
src/Testing/Builder.php

Summary

Maintainability
A
0 mins
Test Coverage

Builder has 23 functions (exceeds 20 allowed). Consider refactoring.
Invalid

class Builder
{
    /**
     * Create a new expectation builder instance.
     *
Severity: Minor
Found in src/Testing/Builder.php - About 2 hrs to fix

    Function is has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Invalid

        #[Pure]
        protected function is(Alert $alert): bool
        {
            if ($this->message !== null && $this->message !== $alert->getMessage()) {
                return false;
    Severity: Minor
    Found in src/Testing/Builder.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 is has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Invalid

        #[Pure]
        protected function is(Alert $alert): bool
        {
            if ($this->message !== null && $this->message !== $alert->getMessage()) {
                return false;
    Severity: Minor
    Found in src/Testing/Builder.php - About 1 hr to fix

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

              public BagFake $bag,
              protected ?string $message = null,
              protected ?array $types = null,
              protected ?bool $dismiss = null,
              protected array|bool|null|string $persisted = null,
      Severity: Major
      Found in src/Testing/Builder.php - About 1 hr to fix

        Avoid too many return statements within this method.
        Wontfix

                        return in_array($alert->getPersistKey(), $this->persisted, true);
        Severity: Major
        Found in src/Testing/Builder.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Wontfix

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

            Avoid too many return statements within this method.
            Wontfix

                        return $this->tags === $alert->getTags();
            Severity: Major
            Found in src/Testing/Builder.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Wontfix

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

                Avoid too many return statements within this method.
                Wontfix

                                return $this->persisted === $alert->getPersistKey();
                Severity: Major
                Found in src/Testing/Builder.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Wontfix

                              return $this->persisted === (bool) $alert->getPersistKey();
                  Severity: Major
                  Found in src/Testing/Builder.php - About 30 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status