Showing 740 of 740 total issues
Function getAddTableDDL
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
public function getAddTableDDL(Table $table): string
{
$table = clone $table;
$tableDescription = $table->hasDescription() ? $this->getCommentLineDDL($table->getDescription()) : '';
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getSharedFks
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function getSharedFks(Column $fromColumn, Column $toColumn): array
{
$sharedKeys = [];
foreach (['getReferrers', 'getForeignKeys'] as $getFk) {
- 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 addJoin
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function addJoin($left, $right, ?string $joinType = null)
{
if (is_array($left) && is_array($right)) {
$conditions = [];
foreach ($left as $key => $value) {
Method buildJoinCondition
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function buildJoinCondition(Criteria $c): void
{
/** @var \Propel\Runtime\ActiveQuery\Criterion\AbstractCriterion|null $joinCondition */
$joinCondition = null;
for ($i = 0; $i < $this->count; $i++) {
Method arrayToDOM
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function arrayToDOM(array $array, DOMElement $rootElement, ?string $charset = null): DOMElement
{
foreach ($array as $key => $value) {
if (is_numeric($key)) {
$key = $rootElement->nodeName;
Method addFindPks
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function addFindPks(string &$script): void
{
$this->declareClasses(
'\Propel\Runtime\Collection\Collection',
'\Propel\Runtime\Connection\ConnectionInterface',
Method convertDOMElementToArray
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function convertDOMElementToArray(DOMNode $data): array
{
$array = [];
$elementNames = [];
/** @var \DOMElement $element */
Method computeDiff
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function computeDiff(ForeignKey $fromFk, ForeignKey $toFk, bool $caseInsensitive = false): bool
{
// Check for differences in local and remote table
$fromDifferentTable = $caseInsensitive ?
strtolower($fromFk->getTableName()) !== strtolower($toFk->getTableName()) :
Method addObjectCompute
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function addObjectCompute(ObjectBuilder $builder): string
{
$conditions = [];
if ($this->getParameter('condition')) {
$conditions[] = $this->getParameter('condition');
Method addDoSelect
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function addDoSelect(string &$script): void
{
$script .= "
public function doSelect(?ConnectionInterface \$con = null): \Propel\Runtime\DataFetcher\DataFetcherInterface
{
Method resolveString
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function resolveString(string $value, array $resolving = [])
{
/*
* %%: to be unescaped
* %[^%\s]++%: a parameter
Method addForeignKeys
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function addForeignKeys(Table $table): void
{
$database = $table->getDatabase();
/** @var \PDOStatement $stmt */
Method addGetPrimaryKeyHash
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function addGetPrimaryKeyHash(string &$script): void
{
// We have to iterate through all the columns so that we know the offset of the primary
// key columns.
$n = 0;
Method parseTables
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function parseTables(Database $database, ?Table $filterTable = null): void
{
$sql = 'SHOW FULL TABLES';
if ($filterTable) {
Method addColumns
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function addColumns(Table $table): void
{
/** @var \Propel\Runtime\DataFetcher\PDODataFetcher $dataFetcher */
$dataFetcher = $this->dbh->query("sp_columns '" . $table->getName() . "'");
$dataFetcher->setStyle(PDO::FETCH_ASSOC);
Method addPopulateObject
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function addPopulateObject(string &$script): void
{
$table = $this->getTable();
$script .= "
/**
Method compareIndices
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function compareIndices(bool $caseInsensitive = false): int
{
$indexDifferences = 0;
$fromTableIndices = array_merge($this->getFromTable()->getIndices(), $this->getFromTable()->getUnices());
$toTableIndices = array_merge($this->getToTable()->getIndices(), $this->getToTable()->getUnices());
Method addSyncParentToChild
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function addSyncParentToChild(string &$script): void
{
$parentTable = $this->getParentTable();
$parentClass = $this->builder->getClassNameFromBuilder($this->builder->getNewStubObjectBuilder($parentTable));
Method addDeleteDescendants
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function addDeleteDescendants(string &$script): void
{
$objectClassName = $this->builder->getObjectClassName();
$queryClassName = $this->builder->getQueryClassName();
$tableMapClass = $this->builder->getTableMapClass();
Method search
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function search($element)
{
$hashes = [];
$isActiveRecord = [];
foreach (func_get_args() as $pos => $obj) {