Showing 28 of 115 total issues
Function migrate
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
public function migrate(Migration $migration, Table $before, SqlSetting $setting): void
{
//TODO rename
$meta = [];
if ($this->engine != $before->engine) $meta[] = "ENGINE=" . $this->engine;
- Read upRead up
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 importDump
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function importDump(\PDO $pdo, string $sqlFile): bool
{
$content = file_get_contents($sqlFile);
$queries = explode(";\n", str_replace("\r", "", $content));
$pdo->beginTransaction();
- Read upRead up
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 migrate
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function migrate(Migration $migration, Table $before, SqlSetting $setting): void
{
//TODO rename
$meta = [];
if ($this->engine != $before->engine) $meta[] = "ENGINE=" . $this->engine;
Function resolveLazyIndexes
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function resolveLazyIndexes(): void
{
foreach ($this->indexes as &$index) {
if (StringUtils::contains(get_class($index), "lazy")) {
if ($index instanceof LazyIndex || $index instanceof LazyUnique) {
- Read upRead up
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 migrate
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function migrate(Database $before, SqlSetting $setting, array $renames = null /*TODO*/): Migration
{
$migration = new Migration();
if ($this->name != $before->name) $migration->todo("TODO: rename database to >" . $this->name . "< from >" . $before->name . "<");
$myTables = $this->topoOrder($this->getTables());
- Read upRead up
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 complete
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function complete(): DatabaseBuilder
{
$this->table->init($this->engine != null ? $this->engine : $this->db->getDefaultEngine(),
$this->charset != null ? $this->charset : $this->db->getDefaultCharset(),
$this->collation != null ? $this->collation : $this->db->getDefaultCollation(),
- Read upRead up
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 toCreateSql
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function toCreateSql(SqlSetting $setting): string
{
$delimiter = $setting->singleLine ? " " : "\n";
$sql = 'CREATE TABLE ';
if ($setting->createTableIfNotExists) $sql .= 'IF NOT EXISTS ';
- Read upRead up
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 fromSql
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function fromSql(TableBuilder $tb, string $constraint): void
{
//TODO more robust
if (StringUtils::contains($constraint, "FOREIGN KEY", true)) {
$onUpdate = ReferenceOption::memberByValueWithDefault(StringUtils::findAndRemove($constraint, "@ON UPDATE (RESTRICT|CASCADE|SET NULL|NO ACTION)@i"), null);
- Read upRead up
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 modifySql
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function modifySql(Field $before, SqlSetting $setting): ?string
{
//TODO rename
$ta = $this->type;
$tb = $before->type;
- Read upRead up
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 fromDatabase
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function fromDatabase(\PDO $pdo, DatabaseBuilder $db, string $tableName, string $engine, string $collation, string $currentAutoincrement = null, array $booleanFields = []): void
{
$tb = $db->table($tableName)->engine($engine)->charset(explode("_", $collation, 2)[0])->collation($collation)->autoincrement(intval($currentAutoincrement));
- Read upRead up
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 topoOrder
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function topoOrder(array $tables): array
{
$result = [];
while (count($tables)) {
$added = false;
- Read upRead up
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 __construct
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(string $tableName, array $fieldNames, string $name = null, string $referenceTableName, array $referenceFields, ReferenceOption $onUpdate, ReferenceOption $onDelete)
Method fromDatabase
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function fromDatabase(\PDO $pdo, DatabaseBuilder $db, string $tableName, string $engine, string $collation, string $currentAutoincrement = null, array $booleanFields = []): void
Method foreign
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function foreign(array $fields, string $referenceTable, array $referenceFields, ReferenceOption $onUpdate, ReferenceOption $onDelete, string $name = null): TableBuilder
Function toBuilderCode
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function toBuilderCode(): string
{
$result = "\n ->table(\"" . $this->name . "\")";
foreach ($this->indexes as $index) {
$result .= $index->toBuilderCode();
- Read upRead up
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 __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct(array $fields = null, string $name = null, Table &$referenceTable = null, array $referenceFields, ReferenceOption $onUpdate, ReferenceOption $onDelete)
Method bindColumn
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function bindColumn($column, &$param, $type = null, $maxlen = null, $driverdata = null)
Method bindParam
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function bindParam($parameter, &$variable, $data_type = \PDO::PARAM_STR, $length = null, $driver_options = null)
Method onDuplicateAndExec
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static function onDuplicateAndExec(\PDO $pdo, int $onDuplicate, array $keys, string $sql, array $params): int
Method foreign
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function foreign(string $name = null, string $table, string $reference, ReferenceOption $onUpdate, ReferenceOption $onDelete): FieldBuilder