File SqlitePlatform.php
has 395 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* MIT License. This file is part of the Propel package.
* For the full copyright and license information, please view the LICENSE
Function normalizeTable
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function normalizeTable(Table $table): void
{
if ($table->getPrimaryKey()) {
//search if there is already a UNIQUE constraint over the primary keys
$pkUniqueExist = 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
SqlitePlatform
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
class SqlitePlatform extends DefaultPlatform
{
/**
* If we should generate FOREIGN KEY statements.
* This is since SQLite version 3.6.19 possible.
Function getModifyTableDDL
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function getModifyTableDDL(TableDiff $tableDiff): string
{
$changedNotEditableThroughDirectDDL = $this->tableAlteringWorkaround && (
$tableDiff->hasModifiedFks()
|| $tableDiff->hasModifiedIndices()
- 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 getMigrationTableDDL
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getMigrationTableDDL(TableDiff $tableDiff): string
{
$pattern = "
CREATE TEMPORARY TABLE %s AS SELECT %s FROM %s;
DROP TABLE %s;
Consider simplifying this complex logical expression. Open
if ($this->tableAlteringWorkaround && !$changedNotEditableThroughDirectDDL && $tableDiff->hasAddedColumns()) {
$addedCols = $tableDiff->getAddedColumns();
foreach ($addedCols as $column) {
$sqlChangeNotSupported =
//The column may not have a PRIMARY KEY or UNIQUE constraint.
Method getAddTableDDL
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAddTableDDL(Table $table): string
{
$table = clone $table;
$tableDescription = $table->hasDescription() ? $this->getCommentLineDDL($table->getDescription()) : '';
Method getModifyTableDDL
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getModifyTableDDL(TableDiff $tableDiff): string
{
$changedNotEditableThroughDirectDDL = $this->tableAlteringWorkaround && (
$tableDiff->hasModifiedFks()
|| $tableDiff->hasModifiedIndices()
Method normalizeTable
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function normalizeTable(Table $table): void
{
if ($table->getPrimaryKey()) {
//search if there is already a UNIQUE constraint over the primary keys
$pkUniqueExist = false;
Function getAddTableDDL
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getAddTableDDL(Table $table): string
{
$table = clone $table;
$tableDescription = $table->hasDescription() ? $this->getCommentLineDDL($table->getDescription()) : '';
- 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 getMigrationTableDDL
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getMigrationTableDDL(TableDiff $tableDiff): string
{
$pattern = "
CREATE TEMPORARY TABLE %s AS SELECT %s FROM %s;
DROP TABLE %s;
- 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"