mooxphp/moox

View on GitHub
packages/redis-model/src/Model.php

Summary

Maintainability
F
3 days
Test Coverage

Model has 70 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class Model implements Arrayable, ArrayAccess, CanBeEscapedWhenCastToString, Jsonable, JsonSerializable
{
    use ForwardsCalls,
        GuardsAttributes,
        HasAttributes,
Severity: Major
Found in packages/redis-model/src/Model.php - About 1 day to fix

    File Model.php has 561 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Moox\RedisModel;
    
    use ArrayAccess;
    Severity: Major
    Found in packages/redis-model/src/Model.php - About 1 day to fix

      Function insert has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function insert(array $dataInsert, ?Redis $hasTransaction = null)
          {
              $inserts = [];
              $build = static::query();
              $model = $build->getModel();
      Severity: Minor
      Found in packages/redis-model/src/Model.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 fill has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function fill(array $attributes)
          {
              $totallyGuarded = $this->totallyGuarded();
      
              $fillable = $this->fillableFromArray($attributes);
      Severity: Minor
      Found in packages/redis-model/src/Model.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 performInsert has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function performInsert(Builder $build)
          {
              // First we'll need to create a fresh query instance and touch the creation and
              // update timestamps on this model, which are maintained by us for developer
              // convenience. After, we will just continue saving these model instances.
      Severity: Minor
      Found in packages/redis-model/src/Model.php - About 1 hr to fix

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

            protected function performInsert(Builder $build)
            {
                // First we'll need to create a fresh query instance and touch the creation and
                // update timestamps on this model, which are maintained by us for developer
                // convenience. After, we will just continue saving these model instances.
        Severity: Minor
        Found in packages/redis-model/src/Model.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 fill has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function fill(array $attributes)
            {
                $totallyGuarded = $this->totallyGuarded();
        
                $fillable = $this->fillableFromArray($attributes);
        Severity: Minor
        Found in packages/redis-model/src/Model.php - About 1 hr to fix

          There are no issues that match your filters.

          Category
          Status