Function setDb
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
public function setDb(array $dbData, bool $importData = true): void
{
foreach ($dbData as $tableName => $data) {
$idField = $data['_types']['_idField'] ?? 'id';
unset($data['_types']['_idField']);
- Read upRead up
- Create a ticketCreate a ticket
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 compareExportUnorderedValue
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
private static function compareExportUnorderedValue($a, $b): int
{
if ($a === $b) {
return 0;
}
- Read upRead up
- Create a ticketCreate a ticket
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
Consider simplifying this complex logical expression. Open
if ($matches[3] === 'BOOLEAN' && ($types[$k] === ParameterType::BOOLEAN || $types[$k] === ParameterType::INTEGER)
&& (is_bool($params[$k]) || $params[$k] === '0' || $params[$k] === '1')
) {
$types[$k] = ParameterType::BOOLEAN;
$params[$k] = (bool) $params[$k];
- Create a ticketCreate a ticket
File TestCase.php
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
namespace Atk4\Data\Schema;
- Create a ticketCreate a ticket
Method compareExportUnorderedValue
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function compareExportUnorderedValue($a, $b): int
{
if ($a === $b) {
return 0;
}
- Create a ticketCreate a ticket
Method setDb
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setDb(array $dbData, bool $importData = true): void
{
foreach ($dbData as $tableName => $data) {
$idField = $data['_types']['_idField'] ?? 'id';
unset($data['_types']['_idField']);
- Create a ticketCreate a ticket
Method logQuery
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function logQuery(string $sql, array $params, array $types): void
{
if (!$this->debug) {
return;
}
- Create a ticketCreate a ticket
Function getDb
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getDb(?array $tableNames = null, bool $noId = false): array
{
if ($tableNames === null) {
$tableNames = [];
foreach ($this->createdMigrators as $migrator) {
- Read upRead up
- Create a ticketCreate a ticket
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
Avoid too many return
statements within this method. Open
return $matches[4] ?? $matches[2];
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return $matches[2];
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return $cmp;
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return $matches[4] ?? $matches[2];
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return $matches[2];
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return $matches[0];
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return $a <=> $b;
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return $convertedSql;
- Create a ticketCreate a ticket
Function tearDown
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
#[\Override]
protected function tearDown(): void
{
$debugOrig = $this->debug;
try {
- Read upRead up
- Create a ticketCreate a ticket
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"