Function updateTables
has a Cognitive Complexity of 150 (exceeds 5 allowed). Consider refactoring. Open
public function updateTables(Base $importer)
{
$this->logs .= "> start update tables ({$importer->dbType})\n";
$startMain = microtime(true);
$schema = $importer->db->getSchema();
- 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
File Importer.php
has 658 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* File that imports structure and data to database.
*
* @package App
Function addData
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
public function addData(Base $importer)
{
if (!isset($importer->data)) {
return;
}
- 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 updateTables
has 154 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateTables(Base $importer)
{
$this->logs .= "> start update tables ({$importer->dbType})\n";
$startMain = microtime(true);
$schema = $importer->db->getSchema();
Function addTables
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public function addTables(Base $importer)
{
$this->logs .= "> start add tables ({$importer->dbType})\n";
$startMain = microtime(true);
foreach ($importer->tables as $tableName => $table) {
- 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
The class Importer has 22 public methods. Consider refactoring Importer to keep number of public methods under 10. Open
class Importer
{
/**
* End of line character.
*
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
The class Importer has an overall complexity of 170 which is very high. The configured complexity threshold is 50. Open
class Importer
{
/**
* End of line character.
*
- Exclude checks
Importer
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class Importer
{
/**
* End of line character.
*
Method addData
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addData(Base $importer)
{
if (!isset($importer->data)) {
return;
}
Method addTables
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addTables(Base $importer)
{
$this->logs .= "> start add tables ({$importer->dbType})\n";
$startMain = microtime(true);
foreach ($importer->tables as $tableName => $table) {
Function updateForeignKey
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function updateForeignKey(Base $importer)
{
if (!isset($importer->foreignKey)) {
return;
}
- 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 dropForeignKeys
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function dropForeignKeys(array $foreignKeys)
{
$this->logs .= "> start drop foreign keys\n";
$startMain = microtime(true);
$db = \App\Db::getInstance();
- 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 updateForeignKey
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function updateForeignKey(Base $importer)
{
if (!isset($importer->foreignKey)) {
return;
}
Function dropIndexes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function dropIndexes(array $tables)
{
$this->logs .= "> start drop indexes\n";
$startMain = microtime(true);
$db = \App\Db::getInstance();
- 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 getIndexes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function getIndexes(Base $importer, $table)
{
if (!isset($table['index'])) {
return 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
Function loadFiles
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function loadFiles($path = false)
{
$dir = new \DirectoryIterator($path ?: $this->path);
foreach ($dir as $fileinfo) {
if ('dir' !== $fileinfo->getType() && 'php' === $fileinfo->getExtension()) {
- 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 dropForeignKeys
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function dropForeignKeys(array $foreignKeys)
{
$this->logs .= "> start drop foreign keys\n";
$startMain = microtime(true);
$db = \App\Db::getInstance();
Function renameColumns
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function renameColumns($columns)
{
$this->logs .= "> start rename columns\n";
$startMain = microtime(true);
$db = \App\Db::getInstance();
- 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 renameTables
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function renameTables($tables)
{
$this->logs .= "> start rename tables\n";
$startMain = microtime(true);
$db = \App\Db::getInstance();
- 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 dropColumns
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function dropColumns($columns)
{
$this->logs .= "> start drop columns\n";
$startMain = microtime(true);
$db = \App\Db::getInstance();
- 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 dropTable
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function dropTable($tables)
{
$this->logs .= "> start drop tables\n";
$startMain = microtime(true);
$db = \App\Db::getInstance();
- 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 addForeignKey
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function addForeignKey(Base $importer)
{
if (!isset($importer->foreignKey)) {
return;
}
- 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
The method addData() has an NPath complexity of 640. The configured NPath complexity threshold is 200. Open
public function addData(Base $importer)
{
if (!isset($importer->data)) {
return;
}
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method updateTables() has an NPath complexity of 2057681. The configured NPath complexity threshold is 200. Open
public function updateTables(Base $importer)
{
$this->logs .= "> start update tables ({$importer->dbType})\n";
$startMain = microtime(true);
$schema = $importer->db->getSchema();
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method updateTables() has 157 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public function updateTables(Base $importer)
{
$this->logs .= "> start update tables ({$importer->dbType})\n";
$startMain = microtime(true);
$schema = $importer->db->getSchema();
- Exclude checks
The method addTables() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10. Open
public function addTables(Base $importer)
{
$this->logs .= "> start add tables ({$importer->dbType})\n";
$startMain = microtime(true);
foreach ($importer->tables as $tableName => $table) {
- Read upRead up
- Exclude checks
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 addData() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10. Open
public function addData(Base $importer)
{
if (!isset($importer->data)) {
return;
}
- Read upRead up
- Exclude checks
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 updateTables() has a Cyclomatic Complexity of 48. The configured cyclomatic complexity threshold is 10. Open
public function updateTables(Base $importer)
{
$this->logs .= "> start update tables ({$importer->dbType})\n";
$startMain = microtime(true);
$schema = $importer->db->getSchema();
- Read upRead up
- Exclude checks
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
This function "updateTables" has 156 lines, which is greater than the 150 lines authorized. Split it into smaller functions. Open
public function updateTables(Base $importer)
- Read upRead up
- Exclude checks
A function that grows too large tends to aggregate too many responsibilities.
Such functions inevitably become harder to understand and therefore harder to maintain.
Above a specific threshold, it is strongly advised to refactor into smaller functions which focus on well-defined tasks.
Those smaller functions will not only be easier to understand, but also probably easier to test.
Class "Importer" has 26 methods, which is greater than 20 authorized. Split it into smaller classes. Open
class Importer
- Read upRead up
- Exclude checks
A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.
Refactor this function to reduce its Cognitive Complexity from 42 to the 15 allowed. Open
public function addData(Base $importer)
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Refactor this function to reduce its Cognitive Complexity from 39 to the 15 allowed. Open
public function addTables(Base $importer)
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Refactor this function to reduce its Cognitive Complexity from 175 to the 15 allowed. Open
public function updateTables(Base $importer)
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
The method loadFiles has a boolean flag argument $path, which is a certain sign of a Single Responsibility Principle violation. Open
public function loadFiles($path = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '350', column '15'). Open
if ((new \App\Db\Query())->from($tableName)->where(array_combine($keys, $table['values'][0]))->exists($importer->db)) {
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '78', column '14'). Open
$dir = new \DirectoryIterator($path ?: $this->path);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '366', column '16'). Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '325', column '16'). Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '394', column '17'). Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '767', column '18'). Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '204', column '18'). Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '221', column '18'). Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '797', column '19'). Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '731', column '16'). Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method logs has a boolean flag argument $show, which is a certain sign of a Single Responsibility Principle violation. Open
public function logs($show = true)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '400', column '17'). Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '189', column '16'). Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method updateTables uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$tableSchema = $schema->getTableSchema($tableName);
foreach ($this->getColumns($importer, $table) as $columnName => $column) {
$renameFrom = $mode = null;
if (\is_array($column)) {
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Db' in method 'renameTables'. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Db' in method 'dropForeignKeys'. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method logs uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
file_put_contents('cache/logs/Importer.log', $this->logs . '------------- ' . date('Y-m-d H:i:s') . " ($time min) -------------\n", LOCK_EX);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Db' in method 'renameColumns'. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Db' in method 'dropIndexes'. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid assigning values to variables in if clauses and the like (line '734', column '8'). Open
public function updateTables(Base $importer)
{
$this->logs .= "> start update tables ({$importer->dbType})\n";
$startMain = microtime(true);
$schema = $importer->db->getSchema();
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
The method addData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->logs .= "| Error: No values\n";
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method renameTables uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->logs .= " | Error - table does not exist\n";
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method dropTable uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->logs .= " | Info - table does not exist\n";
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method dropForeignKeys uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->logs .= " | Error - table does not exists\n";
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Db' in method 'dropColumns'. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method updateTables uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->logs .= " > create index: {$index[0]} ... ";
$start = microtime(true);
$dbCommand->createIndex($index[0], $tableName, $index[1], !empty($index[2]))->execute();
$time = round((microtime(true) - $start), 1);
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method addData uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$start = microtime(true);
foreach ($table['values'] as $values) {
$importer->db->createCommand()->insert($tableName, array_combine($keys, $values))->execute();
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method dropColumns uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->logs .= " | Info - table or column does not exist\n";
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method dropForeignKeys uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->logs .= " | Info - foreign key not exists\n";
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method renameColumns uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->logs .= " | Warning - table or column does not exists\n";
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid assigning values to variables in if clauses and the like (line '192', column '8'). Open
public function addTables(Base $importer)
{
$this->logs .= "> start add tables ({$importer->dbType})\n";
$startMain = microtime(true);
foreach ($importer->tables as $tableName => $table) {
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
The method dropIndexes uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$this->logs .= " | Info - index not exists\n";
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Db' in method 'dropTable'. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method updateTables uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
foreach ($dbIndexes[$index[0]] as $dbIndex) {
if (empty($index[2]) !== empty($dbIndex['unique'])) {
$update = true;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Define a constant instead of duplicating this literal "columns" 3 times. Open
if (empty($table['columns'])) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "Importer error: " 10 times. Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "values" 4 times. Open
if (\is_array($table['values']) && isset($table['values'][0])) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "Y-m-d H:i:s" 3 times. Open
$this->logs = '------------- ' . date('Y-m-d H:i:s') . " -------------\n";
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "primaryKeys" 7 times. Open
if (isset($table['primaryKeys'])) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Call to undeclared method \App\Db::getDriverName
Open
if ('mysql' === $importer->db->getDriverName()) {
- Exclude checks
Call to undeclared method \App\Db::getSchema
Open
\App\Db::getInstance()->getSchema()->getTableSchemas('', true);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$importer->db->createCommand()->addPrimaryKey($primaryKey[0], $tableName, $primaryKey[1])->execute();
- Exclude checks
Call to undeclared method \App\Db::getDriverName
Open
$type = $importer->db->getDriverName();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$importer->db->createCommand()->createTable($tableName, $this->getColumns($importer, $table), $this->getOptions($importer, $table))->execute();
- Exclude checks
Call to undeclared method \App\Db::getDriverName
Open
$type = $importer->db->getDriverName();
- Exclude checks
Returning type false
but getIndexes()
is declared to return array
Open
return false;
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$importer->db->createCommand()->createIndex($index[0], $tableName, $index[1], (isset($index[2]) && $index[2]) ? true : false)->execute();
- Exclude checks
Reference to undeclared property \App\Db->tablePrefix
Open
$keyName = str_replace('#__', $db->tablePrefix, $keyName);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->dropForeignKey($keyName, $tableName)->execute();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = $db->createCommand();
- Exclude checks
Checking instanceof against undeclared class \yii\db\ColumnSchemaBuilder
(Did you mean class \App\Db\Drivers\Mysql\ColumnSchemaBuilder or class \App\Db\Drivers\Pgsql\ColumnSchemaBuilder) Open
if ($columnExists && $column instanceof \yii\db\ColumnSchemaBuilder && $this->compareColumns($queryBuilder, $tableSchema->columns[$columnName], $column)) {
- Exclude checks
Reference to constant TYPE_BIGINT
from undeclared class \yii\db\Schema
(Did you mean class \App\Db\Drivers\Mysql\Schema or class \App\Db\Drivers\Pgsql\Schema) Open
$column->set('type', \in_array($column->get('type'), ['ubigpk', 'bigpk']) ? \yii\db\Schema::TYPE_BIGINT : \yii\db\Schema::TYPE_INTEGER);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = $importer->db->createCommand();
- Exclude checks
Returning type ?string
but getOptions()
is declared to return string
Open
return $options;
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$importer->db->createCommand()->addForeignKey($key[0], $key[1], $key[2], $key[3], $key[4], $key[5] ?? null, $key[6] ?? null)->execute();
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
if ((new \App\Db\Query())->from($tableName)->where(array_combine($keys, $table['values'][0]))->exists($importer->db)) {
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$importer->db->createCommand()->insert($tableName, array_combine($keys, $values))->execute();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = $db->createCommand();
- Exclude checks
Call to undeclared method \App\Db::getSchema
Open
$schema = $db->getSchema();
- Exclude checks
Reference to instance property isUnsigned
from undeclared class \yii\db\ColumnSchemaBuilder
Open
|| ($baseColumn->unsigned !== $targetColumn->isUnsigned)
- Exclude checks
Reference to instance property autoIncrement
from undeclared class \yii\db\ColumnSchema
Open
|| ($baseColumn->autoIncrement !== $targetColumn->autoIncrement);
- Exclude checks
Call to undeclared method \App\Db::getSchema
Open
$schema = $importer->db->getSchema();
- Exclude checks
Reference to constant TYPE_INTEGER
from undeclared class \yii\db\Schema
(Did you mean class \App\Db\Drivers\Mysql\Schema or class \App\Db\Drivers\Pgsql\Schema) Open
$column->set('type', \in_array($column->get('type'), ['ubigpk', 'bigpk']) ? \yii\db\Schema::TYPE_BIGINT : \yii\db\Schema::TYPE_INTEGER);
- Exclude checks
Checking instanceof against undeclared class \yii\db\ColumnSchemaBuilder
(Did you mean class \App\Db\Drivers\Mysql\ColumnSchemaBuilder or class \App\Db\Drivers\Pgsql\ColumnSchemaBuilder) Open
} elseif (!($column instanceof \yii\db\ColumnSchemaBuilder)) {
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$importer->db->createCommand()->checkIntegrity($check)->execute();
- Exclude checks
Reference to instance property allowNull
from undeclared class \yii\db\ColumnSchema
Open
|| ($baseColumn->allowNull !== (null === $targetColumn->isNotNull))
- Exclude checks
Reference to instance property defaultValue
from undeclared class \yii\db\ColumnSchema
Open
|| ($baseColumn->defaultValue !== $targetColumn->default)
- Exclude checks
Call to undeclared method \App\Db::getSchema
Open
$schema = $db->getSchema();
- Exclude checks
Call to method set
from undeclared class \yii\db\ColumnSchemaBuilder
(Did you mean class \App\Db\Drivers\Mysql\ColumnSchemaBuilder or class \App\Db\Drivers\Pgsql\ColumnSchemaBuilder) Open
$column->set('type', \in_array($column->get('type'), ['ubigpk', 'bigpk']) ? \yii\db\Schema::TYPE_BIGINT : \yii\db\Schema::TYPE_INTEGER);
- Exclude checks
Reference to instance property autoIncrement
from undeclared class \yii\db\ColumnSchemaBuilder
Open
|| ($baseColumn->autoIncrement !== $targetColumn->autoIncrement);
- Exclude checks
Call to undeclared method \App\Db::getSchema
Open
$schema = $importer->db->getSchema();
- Exclude checks
Checking instanceof against undeclared class \yii\db\ColumnSchemaBuilder
(Did you mean class \App\Db\Drivers\Mysql\ColumnSchemaBuilder or class \App\Db\Drivers\Pgsql\ColumnSchemaBuilder) Open
if ($column instanceof \yii\db\ColumnSchemaBuilder && (\in_array($column->get('type'), ['upk', 'pk', 'ubigpk', 'bigpk']))) {
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->dropTable($tableName)->execute();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = $db->createCommand();
- Exclude checks
Call to method get
from undeclared class \yii\db\ColumnSchemaBuilder
(Did you mean class \App\Db\Drivers\Mysql\ColumnSchemaBuilder or class \App\Db\Drivers\Pgsql\ColumnSchemaBuilder) Open
if ($column instanceof \yii\db\ColumnSchemaBuilder && (\in_array($column->get('type'), ['upk', 'pk', 'ubigpk', 'bigpk']))) {
- Exclude checks
Call to method get
from undeclared class \yii\db\ColumnSchemaBuilder
(Did you mean class \App\Db\Drivers\Mysql\ColumnSchemaBuilder or class \App\Db\Drivers\Pgsql\ColumnSchemaBuilder) Open
$column->set('type', \in_array($column->get('type'), ['ubigpk', 'bigpk']) ? \yii\db\Schema::TYPE_BIGINT : \yii\db\Schema::TYPE_INTEGER);
- Exclude checks
Call to method getColumnType
from undeclared class \yii\db\QueryBuilder
Open
return strtok($baseColumn->dbType, ' ') !== strtok($queryBuilder->getColumnType($targetColumn), ' ')
- Exclude checks
Reference to instance property default
from undeclared class \yii\db\ColumnSchemaBuilder
Open
|| ($baseColumn->defaultValue !== $targetColumn->default)
- Exclude checks
Call to undeclared method \App\Db::getTableSchema
Open
$tableSchema = $importer->db->getTableSchema($tableName);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$importer->db->createCommand()->resetSequence($tableName)->execute();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = $importer->db->createCommand();
- Exclude checks
Parameter $queryBuilder
has undeclared type \yii\db\QueryBuilder
Open
protected function compareColumns(\yii\db\QueryBuilder $queryBuilder, \yii\db\ColumnSchema $baseColumn, \yii\db\ColumnSchemaBuilder $targetColumn)
- Exclude checks
Reference to instance property dbType
from undeclared class \yii\db\ColumnSchema
Open
return strtok($baseColumn->dbType, ' ') !== strtok($queryBuilder->getColumnType($targetColumn), ' ')
- Exclude checks
Call to undeclared method \App\Db::getTableSchema
Open
$tableSchema = $db->getTableSchema($tableName, true);
- Exclude checks
Reference to instance property unsigned
from undeclared class \yii\db\ColumnSchema
Open
|| ($baseColumn->unsigned !== $targetColumn->isUnsigned)
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->dropIndex($index, $tableName)->execute();
- Exclude checks
Parameter $baseColumn
has undeclared type \yii\db\ColumnSchema
Open
protected function compareColumns(\yii\db\QueryBuilder $queryBuilder, \yii\db\ColumnSchema $baseColumn, \yii\db\ColumnSchemaBuilder $targetColumn)
- Exclude checks
Parameter $targetColumn
has undeclared type \yii\db\ColumnSchemaBuilder
(Did you mean class \App\Db\Drivers\Mysql\ColumnSchemaBuilder or class \App\Db\Drivers\Pgsql\ColumnSchemaBuilder) Open
protected function compareColumns(\yii\db\QueryBuilder $queryBuilder, \yii\db\ColumnSchema $baseColumn, \yii\db\ColumnSchemaBuilder $targetColumn)
- Exclude checks
Reference to instance property isNotNull
from undeclared class \yii\db\ColumnSchemaBuilder
Open
|| ($baseColumn->allowNull !== (null === $targetColumn->isNotNull))
- Exclude checks
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($db->isTableExists($table[0])) {
$start = microtime(true);
try {
$dbCommand->renameTable($table[0], $table[1])->execute();
$time = round((microtime(true) - $start), 1);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 149.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($tableSchema && isset($tableSchema->columns[$column[1]])) {
$start = microtime(true);
try {
$dbCommand->dropColumn($column[0], $column[1])->execute();
$time = round((microtime(true) - $start), 1);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 149.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (isset($dbIndexes[$index])) {
$start = microtime(true);
try {
$db->createCommand()->dropIndex($index, $tableName)->execute();
$time = round((microtime(true) - $start), 1);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 144.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (isset($tableSchema->foreignKeys[$keyName])) {
$start = microtime(true);
try {
$db->createCommand()->dropForeignKey($keyName, $tableName)->execute();
$time = round((microtime(true) - $start), 1);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 144.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 6 locations. Consider refactoring. Open
try {
$importer->db->createCommand()->createTable($tableName, $this->getColumns($importer, $table), $this->getOptions($importer, $table))->execute();
$time = round((microtime(true) - $start), 1);
$this->logs .= "done ({$time}s)\n";
} catch (\Throwable $e) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 97.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 6 locations. Consider refactoring. Open
try {
$importer->db->createCommand()->createIndex($index[0], $tableName, $index[1], (isset($index[2]) && $index[2]) ? true : false)->execute();
$time = round((microtime(true) - $start), 1);
$this->logs .= "done ({$time}s)\n";
} catch (\Throwable $e) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 97.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 6 locations. Consider refactoring. Open
try {
$importer->db->createCommand()->addPrimaryKey($primaryKey[0], $tableName, $primaryKey[1])->execute();
$time = round((microtime(true) - $start), 1);
$this->logs .= "done ({$time}s)\n";
} catch (\Throwable $e) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 97.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 6 locations. Consider refactoring. Open
try {
$importer->db->createCommand()->resetSequence($tableName)->execute();
$time = round((microtime(true) - $start), 1);
$this->logs .= "done ({$time}s)\n";
} catch (\Throwable $e) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 97.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 6 locations. Consider refactoring. Open
try {
if (isset($dbPrimaryKeys[$primaryKey[0]])) {
$dbCommand->dropPrimaryKey($primaryKey[0], $tableName)->execute();
} elseif ($dbPrimaryKeys) {
$dbCommand->dropPrimaryKey(key($dbPrimaryKeys), $tableName)->execute();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 97.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 6 locations. Consider refactoring. Open
try {
$importer->db->createCommand()->addForeignKey($key[0], $key[1], $key[2], $key[3], $key[4], $key[5] ?? null, $key[6] ?? null)->execute();
$time = round((microtime(true) - $start), 1);
$this->logs .= "done ({$time}s)\n";
} catch (\Throwable $e) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 97.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Spaces must be used to indent lines; tabs are not allowed Open
* End of line character.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string|float
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Array with objects to import.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
require $fileinfo->getPath() . \DIRECTORY_SEPARATOR . $fileinfo->getFilename();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->addTables($importer);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateScheme()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->importers as &$importer) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private $importers = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->scheme();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 156 characters Open
file_put_contents('cache/logs/Importer.log', $this->logs . '------------- ' . date('Y-m-d H:i:s') . " ($time min) -------------\n", LOCK_EX);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->importers as &$importer) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->importers as &$importer) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Base $importer
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($importer->tables as $tableName => $table) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importer->db->createCommand()->createTable($tableName, $this->getColumns($importer, $table), $this->getOptions($importer, $table))->execute();
- Exclude checks
Line exceeds 120 characters; contains 161 characters Open
$importer->db->createCommand()->createIndex($index[0], $tableName, $index[1], (isset($index[2]) && $index[2]) ? true : false)->execute();
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > add primary key: {$primaryKey[0]} ... ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Path to the directory with files to import.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $dieOnError = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Import database structure.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->addForeignKey($importer);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private $startTime;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs = '------------- ' . date('Y-m-d H:i:s') . " -------------\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dir = new \DirectoryIterator($path ?: $this->path);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->importers as &$importer) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Creating tables.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " ({$time}s) | Error(2) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "# end add tables ($time min)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$className = 'Importers\\' . $fileinfo->getBasename('.php');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->importers[] = $instance;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function importData()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function postUpdate()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > add table: $tableName ... ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > create index: {$index[0]} ... ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($dir as $fileinfo) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo $this->logs . '--------- ' . date('Y-m-d H:i:s') . " ($time min) -------------\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function importScheme()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Import database rows.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->importers as &$importer) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Line exceeds 120 characters; contains 159 characters Open
$importer->db->createCommand()->createTable($tableName, $this->getColumns($importer, $table), $this->getOptions($importer, $table))->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($table['primaryKeys'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $logs;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Start time.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->data();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $show
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function logs($show = true)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Post Process action.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importer->db->createCommand()->createIndex($index[0], $tableName, $index[1], (isset($index[2]) && $index[2]) ? true : false)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importer->db->createCommand()->addPrimaryKey($primaryKey[0], $tableName, $primaryKey[1])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $redundantTables = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var Base[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Load all files for import.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('dir' !== $fileinfo->getType() && 'php' === $fileinfo->getExtension()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (method_exists($instance, 'data')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->drop($importer);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
$this->logs .= " ({$time}s) | Error(2) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool|string $path
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update db scheme.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " ({$time}s) | Error(1) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($indexes as $index) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $path = 'install/install_schema';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (method_exists($instance, 'scheme')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function postImport()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateTables($importer);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->dieOnError) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check redundant tables.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance = new $className();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Refresh db schema.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
file_put_contents('cache/logs/Importer.log', $this->logs . '------------- ' . date('Y-m-d H:i:s') . " ($time min) -------------\n", LOCK_EX);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateForeignKey($importer);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function addTables(Base $importer)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " ({$time}s) | Error(3) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
$this->logs .= " ({$time}s) | Error(3) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->dieOnError) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Stop import if an error occurs.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->startTime = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Construct.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __construct()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->getSchema()->getTableSchemas('', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($show) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "> start add tables ({$importer->dbType})\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startMain = microtime(true);
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($indexes = $this->getIndexes($importer, $table)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->dieOnError) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Post Process action.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function loadFiles($path = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function refreshSchema()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Show or save logs.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $this->startTime) / 60, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($table['primaryKeys'] as $primaryKey) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
$importer->db->createCommand()->addPrimaryKey($primaryKey[0], $tableName, $primaryKey[1])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->addData($importer);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $startMain) / 60, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Creates a SQL command for adding a foreign key constraint to an existing table.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($importer->foreignKey as $key) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($table['columns_' . $type] as $column => $customType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$columns[$column] = $customType;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($importer->data)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getColumns(Base $importer, $table)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($table['columns'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($table['columns_' . $type])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startMain = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $startMain) / 60, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > add data to table: $tableName ... ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$options = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Base $importer
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$indexes = $table['index'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($indexes as $key => $index) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function addForeignKey(Base $importer)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "> start reset sequence\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isAutoIncrement = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get index to create.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > custom index, driver: $type, type: {$customIndex['0']} \n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($importer->data as $tableName => $table) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($column->autoIncrement) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $table
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getOptions(Base $importer, $table)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('mysql' === $importer->db->getDriverName()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$type = $importer->db->getDriverName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importer->db->createCommand()->addForeignKey($key[0], $key[1], $key[2], $key[3], $key[4], $key[5] ?? null, $key[6] ?? null)->execute();
- Exclude checks
Line exceeds 120 characters; contains 152 characters Open
$importer->db->createCommand()->addForeignKey($key[0], $key[1], $key[2], $key[3], $key[4], $key[5] ?? null, $key[6] ?? null)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$keys = $table['columns'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ((new \App\Db\Query())->from($tableName)->where(array_combine($keys, $table['values'][0]))->exists($importer->db)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get columns to create.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Base $importer
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $table
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "> start add foreign key ({$importer->dbType})\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "# end add foreign key ($time min)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($table['collate'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($importer->foreignKey)) {
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Base $importer
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$options .= " COLLATE={$table['collate']}";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$type = $importer->db->getDriverName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " ({$time}s) | Error(4) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function addData(Base $importer)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "| Error: No values\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isAutoIncrement = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get additional SQL fragment that will be appended to the generated SQL.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$options = "ENGINE={$table['engine']} DEFAULT CHARSET={$table['charset']}";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($customIndex[0] === $index[0]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$indexes[$key] = $customIndex;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $indexes;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($tableSchema->columns as $column) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $columns;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 139 characters Open
if ((new \App\Db\Query())->from($tableName)->where(array_combine($keys, $table['values'][0]))->exists($importer->db)) {
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "# end add data rows ($time min)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$columns = $table['columns'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Base $importer
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->dieOnError) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "> start add data rows ({$importer->dbType})\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startMain = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->dieOnError) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $startMain) / 60, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > add: {$key[0]}, {$key[1]} ... ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importer->db->createCommand()->insert($tableName, array_combine($keys, $values))->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Base $importer
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Creating rows.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_array($table['values']) && isset($table['values'][0])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($table['values'] as $values) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startMain = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableSchema = $importer->db->getTableSchema($tableName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $table
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($table['index'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($table['index_' . $type])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($table['index_' . $type] as $customIndex) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " | Error(5) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $options;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getIndexes(Base $importer, $table)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "| Info: skipped because it exist first row\n";
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
$importer->db->createCommand()->insert($tableName, array_combine($keys, $values))->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($importer->data as $tableName => $table) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $startMain) / 60, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function renameTables($tables)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->dieOnError) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
$this->logs .= " ({$time}s) | Error(11) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($tableSchema) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > reset sequence: $tableName ... ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $tables
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "> start rename tables\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startMain = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand = $db->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > drop table, {$tableName} ... ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($db->isTableExists($tableName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
$this->logs .= " ({$time}s) | Error(12) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startMain = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > drop index, {$tableName}:{$index} ... ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " | Info - index not exists\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function dropForeignKeys(array $foreignKeys)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* ];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > rename table, {$table[0]} ... ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($db->isTableExists($table[0])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $startMain) / 60, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "> start drop tables\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->dropTable($tableName)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function dropTable($tables)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_string($tables)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startMain = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "# end reset sequence ($time min)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array|string $tables
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
$this->logs .= " ({$time}s) | Error(12) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $startMain) / 60, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "> start drop foreign keys\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($tableSchema->foreignKeys[$keyName])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importer->db->createCommand()->resetSequence($tableName)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " | Info - table {$table[1]} is exists\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $startMain) / 60, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "# end drop tables ($time min)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function dropIndexes(array $tables)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "> start drop indexes\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($isAutoIncrement) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "# end rename tables ($time min)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($foreignKeys as $keyName => $tableName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableSchema = $db->getTableSchema($tableName, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* ['oldName', 'newName']
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->renameTable($table[0], $table[1])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startMain = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($indexes as $index) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* $tables = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "# end drop indexes ($time min)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($tables as $table) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tables = [$tables];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " ({$time}s) | Error(12) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbIndexes = $db->getTableKeys($tableName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->dieOnError) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " ({$time}s) | Error(11) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ($db->isTableExists($table[1])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Drop table.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($tables as $tableName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Drop indexes.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($dbIndexes[$index])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " ({$time}s) | Error(6) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > Error: redundant table {$tableName}_seq !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $tables [$table=>[$index,...],...]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$keyName = str_replace('#__', $db->tablePrefix, $keyName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Rename tables.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " | Error - table does not exist\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->dropIndex($index, $tableName)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* ['u_#__mail_address_boock', 'u_#__mail_address_book']
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Drop foreign keys.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $foreignKeys [$foreignKey=>table,...]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > drop foreign key, {$tableName}:{$keyName} ... ";
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
$this->logs .= " ({$time}s) | Error(6) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->redundantTables && isset($importer->data[$tableName . '_seq'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " | Info - table does not exist\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($tables as $tableName => $indexes) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " ({$time}s) | Error(12) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $columns
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand = $db->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($columns as $column) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $columns
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function dropColumns($columns)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$columnExists = isset($tableSchema->columns[$columnName]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " | Info - foreign key not exists\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " ({$time}s) | Error [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Rename columns.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startMain = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($importer->dropIndexes)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$schema = $db->getSchema();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$column = $column['type'] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($tableSchema && isset($tableSchema->columns[$column[1]])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update tables structure.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($importer->tables as $tableName => $table) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > add table: $tableName ... ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($renameFrom && !$columnExists && isset($tableSchema->columns[$renameFrom])) {
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
$this->logs .= " ({$time}s) | Error [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "> start rename columns\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($tableSchema && isset($tableSchema->columns[$column[1]]) && !isset($tableSchema->columns[$column[2]])) {
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
$this->logs .= " ({$time}s) | Error(13) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
$this->logs .= " ({$time}s) | Error(14) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Base $importer
- Exclude checks
Line exceeds 120 characters; contains 143 characters Open
$dbCommand->createTable($tableName, $this->getColumns($importer, $table), $this->getOptions($importer, $table))->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->renameColumn($column[0], $column[1], $column[2])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " ({$time}s) | Error(13) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Base $importer
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* ];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_array($column)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* $columns = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "# end rename columns ($time min)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function drop(Base $importer)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->dropColumns($importer->dropColumns);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " | Info - table or column does not exist\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->getColumns($importer, $table) as $columnName => $column) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->dropTable($importer->dropTables);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Drop columns.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* ['TableName', 'columnName'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "> start drop columns\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* $columns = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @throws \App\Exceptions\AppException
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableSchema = $schema->getTableSchema($tableName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->dropForeignKey($keyName, $tableName)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " | Error - table does not exists\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand = $db->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $startMain) / 60, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$schema = $db->getSchema();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$schema = $importer->db->getSchema();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$queryBuilder = $schema->getQueryBuilder();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$renameFrom = $mode = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$renameFrom = $column['renameFrom'] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $startMain) / 60, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->renameColumn($tableName, $renameFrom, $columnName)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "# end drop foreign keys ($time min)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function renameColumns($columns)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->dropIndexes($importer->dropIndexes);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* ['vtiger_smsnotifier', 'status'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startMain = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->dropColumn($column[0], $column[1])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "> start update tables ({$importer->dbType})\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mode = $column['mode'] ?? $mode; // 0,null - create/update, 1 - update only
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $startMain) / 60, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* ['TableName', 'oldName', 'newName'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* ['vtiger_smsnotifier', 'status', 'smsnotifier_status'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($importer->dropTables)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($importer->dropColumns)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($columns as $column) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " ({$time}s) | Error(14) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "# end drop columns ($time min)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateTables(Base $importer)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->createTable($tableName, $this->getColumns($importer, $table), $this->getOptions($importer, $table))->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableSchema = $schema->getTableSchema($column[0]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableSchema = $schema->getTableSchema($column[0]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startMain = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > rename column: {$column[0]}:{$column[1]} ... ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " | Warning - table or column does not exists\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > drop column: {$column[0]}:{$column[1]} ... ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$importer->db->isTableExists($tableName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* ];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Drop tables and columns.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand = $importer->db->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > rename column: {$tableName}:{$renameFrom} -> {$columnName}... ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > Warning: column ({$tableName}:{$columnName}) is not verified\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($update) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Line exceeds 120 characters; contains 174 characters Open
if (\is_string($primaryKey[1]) ? !(1 !== \count($dbPrimaryKey) && $primaryKey[1] !== $dbPrimaryKey[0]) : !array_diff($primaryKey[1], $dbPrimaryKey)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " | Error(7) {$tableName} [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->dropPrimaryKey($primaryKey[0], $tableName)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->dieOnError) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (!($column instanceof \yii\db\ColumnSchemaBuilder)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($dbIndexes[$index[0]])) {
- Exclude checks
Line exceeds 120 characters; contains 158 characters Open
if (\is_string($index[1]) ? !isset($dbIndexes[$index[0]][$index[1]]) : array_diff($index[1], array_keys($dbIndexes[$index[0]]))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$status = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$column->set('type', \in_array($column->get('type'), ['ubigpk', 'bigpk']) ? \yii\db\Schema::TYPE_BIGINT : \yii\db\Schema::TYPE_INTEGER);
- Exclude checks
Line exceeds 120 characters; contains 154 characters Open
$importer->foreignKey[] = [$keyName, $sourceTableName, $fk['sourceColumn'], $tableName, $columnName, 'CASCADE', null];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->addPrimaryKey($primaryKey[0], $tableName, $primaryKey[1])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableSchema = $schema->getTableSchema($tableName, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > foreign key must be removed and added in postUpdate: $tableName:$columnName <> {$value[0]}:{$value[$columnName]} FK:{$keyName}\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importer->foreignKey[] = [$keyName, $tableName, $columnName, $value[0], $value[$columnName], 'CASCADE', null];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($indexes = $this->getIndexes($importer, $table)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbIndexes = $importer->db->getTableKeys($tableName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$update = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 201 characters Open
$this->logs .= " > update primary key: {$primaryKey[0]} , table: $tableName , column: " . (\is_array($primaryKey[1]) ? implode(',', $primaryKey[1]) : $primaryKey[1]) . ' ... ';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}elseif (!$columnExists && 1 !== $mode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > add column: $tableName:$columnName ... ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($value[$columnName])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$update = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > update index: {$index[0]} ... ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > create index: {$index[0]} ... ";
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->dropPrimaryKey(key($dbPrimaryKeys), $tableName)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " ({$time}s) | Error(10) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Line exceeds 120 characters; contains 190 characters Open
$this->logs .= " > foreign key must be removed and added in postUpdate: $tableName:$columnName <> {$value[0]}:{$value[$columnName]} FK:{$keyName}\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->alterColumn($tableName, $columnName, $column)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->createIndex($index[0], $tableName, $index[1], !empty($index[2]))->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($table['primaryKeys'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_string($primaryKey[1]) ? !(1 !== \count($dbPrimaryKey) && $primaryKey[1] !== $dbPrimaryKey[0]) : !array_diff($primaryKey[1], $dbPrimaryKey)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $startMain) / 60, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->addColumn($tableName, $columnName, $column)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Line exceeds 120 characters; contains 152 characters Open
if ($column instanceof \yii\db\ColumnSchemaBuilder && (\in_array($column->get('type'), ['upk', 'pk', 'ubigpk', 'bigpk']))) {
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
$importer->foreignKey[] = [$keyName, $tableName, $columnName, $value[0], $value[$columnName], 'CASCADE', null];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($table['primaryKeys'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$table['primaryKeys'][] = [$tableSchema->fullName . '_pk', [$columnName]];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->dieOnError) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($dbIndexes[$index[0]] as $dbIndex) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$update = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$status = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($status) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \yii\db\ColumnSchemaBuilder $targetColumn
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($columnExists && $column instanceof \yii\db\ColumnSchemaBuilder && $this->compareColumns($queryBuilder, $tableSchema->columns[$columnName], $column)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importer->foreignKey[] = [$keyName, $sourceTableName, $fk['sourceColumn'], $tableName, $columnName, 'CASCADE', null];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($dbPrimaryKeys as $dbPrimaryKey) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > update primary key: {$primaryKey[0]} , table: $tableName , column: " . (\is_array($primaryKey[1]) ? implode(',', $primaryKey[1]) : $primaryKey[1]) . ' ... ';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 179 characters Open
if ($columnExists && $column instanceof \yii\db\ColumnSchemaBuilder && $this->compareColumns($queryBuilder, $tableSchema->columns[$columnName], $column)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($column instanceof \yii\db\ColumnSchemaBuilder && (\in_array($column->get('type'), ['upk', 'pk', 'ubigpk', 'bigpk']))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($schema->findForeignKeyToColumn($tableName, $columnName) as $sourceTableName => $fks) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$table['primaryKeys'] = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->dropIndex($index[0], $tableName)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$primaryKey = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbPrimaryKeys = $importer->db->getPrimaryKey($tableName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($table['primaryKeys'] as $primaryKey) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$primaryKey = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Compare two columns if they are identical.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($tableSchema->foreignKeys) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fks as $keyName => $fk) {
- Exclude checks
Line exceeds 120 characters; contains 191 characters Open
$this->logs .= " > foreign key must be removed and added in postUpdate: $tableName:$columnName <> $sourceTableName:{$fk['sourceColumn']} FK:{$keyName}\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " | Error(8) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \yii\db\QueryBuilder $queryBuilder
- Exclude checks
Line exceeds 120 characters; contains 168 characters Open
$column->set('type', \in_array($column->get('type'), ['ubigpk', 'bigpk']) ? \yii\db\Schema::TYPE_BIGINT : \yii\db\Schema::TYPE_INTEGER);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($primaryKey) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($index[2]) !== empty($dbIndex['unique'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->dieOnError) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($dbPrimaryKeys[$primaryKey[0]])) {
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \yii\db\ColumnSchema $baseColumn
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$columnExists = isset($tableSchema->columns[$columnName]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->dropForeignKey($keyName, $tableName)->execute();
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
foreach ($schema->findForeignKeyToColumn($tableName, $columnName) as $sourceTableName => $fks) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\AppException('Importer error: ' . $e->getMessage(), (int) $e->getCode(), $e);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($indexes as $index) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ($dbPrimaryKeys) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($tableSchema->foreignKeys as $keyName => $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > foreign key must be removed and added in postUpdate: $tableName:$columnName <> $sourceTableName:{$fk['sourceColumn']} FK:{$keyName}\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->dropForeignKey($keyName, $sourceTableName)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > alter column: $tableName:$columnName ... ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_string($index[1]) ? !isset($dbIndexes[$index[0]][$index[1]]) : array_diff($index[1], array_keys($dbIndexes[$index[0]]))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "# end update tables ({$time}s)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->createIndex($index[0], $tableName, $index[1], !empty($index[2]))->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
$this->logs .= " ({$time}s) | Error(10) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand = $importer->db->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " ({$time}s) | Error(10) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$destTableName = $importer->db->quoteSql($key[3]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
$dbCommand->addForeignKey($keyName, $sourceTableName, $key[2], $destTableName, $key[4], $key[5], $key[6])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update a foreign key constraint to an existing table.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function checkIntegrity($check)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
|| ($baseColumn->autoIncrement !== $targetColumn->autoIncrement);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateForeignKey(Base $importer)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($importer->foreignKey)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$add = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($add) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= " > add: $keyName, $sourceTableName ... ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Line exceeds 120 characters; contains 150 characters Open
protected function compareColumns(\yii\db\QueryBuilder $queryBuilder, \yii\db\ColumnSchema $baseColumn, \yii\db\ColumnSchemaBuilder $targetColumn)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Base $importer
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "done ({$time}s)\n";
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
$this->logs .= " ({$time}s) | Error(10) [{$e->getMessage()}] in \n{$e->getTraceAsString()} !!!\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($tableSchema->foreignKeys as $dbForeignKey) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
|| ($baseColumn->unsigned !== $targetColumn->isUnsigned)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
if ($destTableName === $dbForeignKey[0] && isset($dbForeignKey[$key[2]]) && $key[4] === $dbForeignKey[$key[2]]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$add = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
|| ($baseColumn->allowNull !== (null === $targetColumn->isNotNull))
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $check whether to turn on or off the integrity check.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
|| ($baseColumn->defaultValue !== $targetColumn->default)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$schema = $importer->db->getSchema();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$start = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->addForeignKey($keyName, $sourceTableName, $key[2], $destTableName, $key[4], $key[5], $key[6])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$keyName = $importer->db->quoteSql($key[0]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return strtok($baseColumn->dbType, ' ') !== strtok($queryBuilder->getColumnType($targetColumn), ' ')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sourceTableName = $importer->db->quoteSql($key[1]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($destTableName === $dbForeignKey[0] && isset($dbForeignKey[$key[2]]) && $key[4] === $dbForeignKey[$key[2]]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $startMain) / 60, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "# end update foreign key ({$time}s)\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->importers as &$importer) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round((microtime(true) - $start), 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Builds a SQL command for enabling or disabling integrity check.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->logs .= "> start update foreign key ({$importer->dbType})\n";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startMain = microtime(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($importer->foreignKey as $key) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected function compareColumns(\yii\db\QueryBuilder $queryBuilder, \yii\db\ColumnSchema $baseColumn, \yii\db\ColumnSchemaBuilder $targetColumn)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableSchema = $schema->getTableSchema($sourceTableName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$importer->db->createCommand()->checkIntegrity($check)->execute();
- Exclude checks
Expected 1 space after closing brace; 0 found Open
}elseif (!$columnExists && 1 !== $mode) {
- Exclude checks