brokencube/automatorm

View on GitHub

Showing 452 of 452 total issues

The method generate() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
Open

    public static function generate($path, Schema $schema)
    {
        $namespace = $schema->namespace;
        
        foreach ($schema->model as $model) {
Severity: Minor
Found in src/Generator/Model.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

The method format() has a Cyclomatic Complexity of 23. The configured cyclomatic complexity threshold is 10.
Open

    public static function format($key, $value, $seen = [], $collectionCount = 0, $exceptionThrown = false)
    {
        switch (true) {
            case $value instanceof Model:
                $namespace = explode('\\', get_class($value));
Severity: Minor
Found in src/Orm/Dump.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

The method extractAffix() has a Cyclomatic Complexity of 23. The configured cyclomatic complexity threshold is 10.
Open

    public static function extractAffix($propertyName, $invert = false)
    {
        $parts = [];
        // Look for special non-alphanumeric affixes
        preg_match('/^([!=<>%#]*)([^!=<>%#]+)([!=<>%#]*)$/', $propertyName, $parts);
Severity: Minor
Found in src/OperatorParser.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

The method makeMessage() has a Cyclomatic Complexity of 26. The configured cyclomatic complexity threshold is 10.
Open

    private function makeMessage($code, $data)
    {
        switch ($code) {
            case 'NO_GENERATED_SCHEMA':
                return 'NO_GENERATED_SCHEMA: Could not find a schema definition for namespace: ' . $data;
Severity: Minor
Found in src/Exception/Model.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

The method __construct() has a Cyclomatic Complexity of 27. The configured cyclomatic complexity threshold is 10.
Open

    public function __construct($table)
    {
        if (is_string($table)) {
            preg_match(
                '/^
Severity: Minor
Found in src/Database/QueryBuilder/Table.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

The method __call() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
Open

    public function __call($name, $args)
    {
        // If we use Model::COUNT_ONLY on empty container, return 0
        if (count($this->container) == 0 && is_numeric($args[1]) && ($args[1] & Model::COUNT_ONLY)) {
            return 0;
Severity: Minor
Found in src/Orm/Collection.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

The method filter() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
Open

    public function filter($filter, $invertAffix = false)
    {
        $copy = $this->container;
        
        if (is_array($filter)) {
Severity: Minor
Found in src/Orm/Collection.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

The method factoryObjectCache() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
Open

    final public static function factoryObjectCache($ids, $classOrTable = null, Schema $schema = null, $forceRefresh = false)
    {
        $schema = $schema ?: Schema::get(static::getNamespace());
        list(,$table) = $schema->guessContext($classOrTable ?: get_called_class());
        $namespace = $schema->namespace;
Severity: Minor
Found in src/Orm/Model.php by phpmd

CyclomaticComplexity

Since: 0.1

Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

Example

// Cyclomatic Complexity = 11
class Foo {
1   public function example() {
2       if ($a == $b) {
3           if ($a1 == $b1) {
                fiddle();
4           } elseif ($a2 == $b2) {
                fiddle();
            } else {
                fiddle();
            }
5       } elseif ($c == $d) {
6           while ($c == $d) {
                fiddle();
            }
7        } elseif ($e == $f) {
8           for ($n = 0; $n < $h; $n++) {
                fiddle();
            }
        } else {
            switch ($z) {
9               case 1:
                    fiddle();
                    break;
10              case 2:
                    fiddle();
                    break;
11              case 3:
                    fiddle();
                    break;
                default:
                    fiddle();
                    break;
            }
        }
    }
}

Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

Line exceeds 120 characters; contains 147 characters
Open

                // For each foreign key, store details in the table it point to on how to get to the OTHER table in the "Many to Many" relationship

Line exceeds 120 characters; contains 166 characters
Open

                            $this->connection->getDataStore()->getData($key['schema'])->addCrossSchemaForeignKey($refTableName, 'one-to-many', $propertyName, $value);

Line exceeds 120 characters; contains 263 characters
Open

                return 'NO_SCHEMA: Could not find a schema definition for this object (' . $classOrTable . '). Are you sure the classname and table are the same (case-insensitive). Otherwise, try calling Model::generate_schema(true) to refresh the schema cache.';
Severity: Minor
Found in src/Exception/Model.php by phpcodesniffer

Line exceeds 120 characters; contains 122 characters
Open

    protected static $instance; // An internal store of created objects so that objects for each row only get created once
Severity: Minor
Found in src/Orm/Model.php by phpcodesniffer

Line exceeds 120 characters; contains 147 characters
Open

                // For each foreign key, store details in the table it point to on how to get to the OTHER table in the "Many to Many" relationship

Line exceeds 120 characters; contains 155 characters
Open

                return 'MODEL_DATA:MODEL_EXPECTED_FOR_KEY: Property "'.$column.'" expected a Model object, but you gave it a variable of type "'.$type.'"';
Severity: Minor
Found in src/Exception/Model.php by phpcodesniffer

Line exceeds 120 characters; contains 258 characters
Open

                return 'MODEL_DATA:MODEL_EXPECTED_IN_PIVOT_ARRAY: Property "'.$column.'" represents a M-M (Pivot) relationship. You successfully passed an array to this property, but it was expecting an array of Model objects and you gave it an "'.$type.'"';
Severity: Minor
Found in src/Exception/Model.php by phpcodesniffer

Line exceeds 120 characters; contains 125 characters
Open

                        // needs to have a unique name for at least one of the columns (which is not based on the table name)

Line exceeds 120 characters; contains 174 characters
Open

        if ($this->container[0] instanceof WrappedModel and !property_exists($this->container[0], $parameter) and $this->container[0]->_data->externalKeyExists($parameter)) {
Severity: Minor
Found in src/Orm/Collection.php by phpcodesniffer

Line exceeds 120 characters; contains 192 characters
Open

                    return 'MODEL_DATA:MODEL_EXPECTED_FOR_KEY: Property "'.$column.'" expected a Model object, but you gave it an integer - Perhaps you meant to set "'.$column.'_id" instead?';
Severity: Minor
Found in src/Exception/Model.php by phpcodesniffer

Line exceeds 120 characters; contains 144 characters
Open

                // Call Model objects _init() function - this is to avoid recursion issues with object's natural constructor and the cache above
Severity: Minor
Found in src/Orm/Model.php by phpcodesniffer

Line exceeds 120 characters; contains 141 characters
Open

            if (!$obj = isset(Model::$instance[$namespace][$table][$row['id']]) ? Model::$instance[$namespace][$table][$row['id']] : false) {
Severity: Minor
Found in src/Orm/Model.php by phpcodesniffer
Severity
Category
Status
Source
Language