efureev/laravel-support

View on GitHub

Showing 30 of 30 total issues

AbstractCastingCollection has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class AbstractCastingCollection implements
    Caster,
    Arrayable,
    Jsonable,
    \Countable,
Severity: Minor
Found in src/Caster/AbstractCastingCollection.php - About 2 hrs to fix

    Method passes has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function passes($attribute, $value)
        {
            if ($this->trimItems) {
                $value = trim($value);
            }
    Severity: Major
    Found in src/Rules/Delimited.php - About 2 hrs to fix

      Method castValue has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function castValue($type, $value)
          {
              switch ($simpleType = strtolower(trim($type))) {
                  case 'int':
                  case 'integer':
      Severity: Minor
      Found in src/Caster/HasCasts.php - About 1 hr to fix

        Method sqlForMaxQuery has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function sqlForMaxQuery(): string
            {
                $where = [];
                if ($this->exists) {
                    $id     = $this->getKey();
        Severity: Minor
        Found in src/Sorting/Model/Sortable.php - About 1 hr to fix

          Function registerService has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function registerService(
                  string $serviceClass,
                  Closure|string $serviceName = null,
                  bool $singleton = false,
                  string $alias = null
          Severity: Minor
          Found in src/ServiceProviders/HasRegisters.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 passes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              public function passes($attribute, $value)
              {
                  if ($this->trimItems) {
                      $value = trim($value);
                  }
          Severity: Minor
          Found in src/Rules/Delimited.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 columnUUID has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected static function columnUUID(
                  Blueprint $table,
                  string $name = 'id',
                  $default = true
              ): ColumnDefinition {
          Severity: Minor
          Found in src/Traits/Database/UUID.php - About 1 hr to fix

            Function objectToArray has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                function objectToArray(mixed $data): mixed
                {
                    if ($data instanceof Arrayable) {
                        $data = $data->toArray();
                    } elseif ($data instanceof \JsonSerializable) {
            Severity: Minor
            Found in src/Global/base.php - About 55 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 reorderingSortingPosition has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                private function reorderingSortingPosition(): void
                {
                    if (($position = $this->{static::getSortingColumnName()}) instanceof Expression) {
                        return;
                    }
            Severity: Minor
            Found in src/Sorting/Model/Sortable.php - About 55 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 createRequest has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    string $method,
                    string $uri,
                    array $parameters = [],
                    array $cookies = [],
                    array $files = [],
            Severity: Major
            Found in src/Test/CreateHttpRequests.php - About 50 mins to fix

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

                  protected static function columnUUID(
                      Blueprint $table,
                      string $name = 'id',
                      $default = true
                  ): ColumnDefinition {
              Severity: Minor
              Found in src/Traits/Database/UUID.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

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

                  public function originalIsEquivalent($key): bool
                  {
                      if (!array_key_exists($key, $this->original)) {
                          return false;
                      }
              Severity: Minor
              Found in src/Caster/HasCasts.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 (array)$items->jsonSerialize();
              Severity: Major
              Found in src/Caster/AbstractCastingCollection.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return (bool)$value;
                Severity: Major
                Found in src/Caster/HasCasts.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return $this->fromJson($value, true);
                  Severity: Major
                  Found in src/Caster/HasCasts.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return $this->asTimestamp($value);
                    Severity: Major
                    Found in src/Caster/HasCasts.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return $type->castFromDatabase($value);
                      Severity: Major
                      Found in src/Caster/HasCasts.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return iterator_to_array($items);
                        Severity: Major
                        Found in src/Caster/AbstractCastingCollection.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          return $this->asDate($value);
                          Severity: Major
                          Found in src/Caster/HasCasts.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                    return true;
                            Severity: Major
                            Found in src/Rules/Delimited.php - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language