File AbstractOMBuilder.php
has 616 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* MIT License. This file is part of the Propel package.
* For the full copyright and license information, please view the LICENSE
AbstractOMBuilder
has 53 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class AbstractOMBuilder extends DataModelBuilder
{
use PathTrait;
/**
Function getCrossFKsPhpNameAffix
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function getCrossFKsPhpNameAffix(CrossForeignKeys $crossFKs, bool $plural = true): string
{
$names = [];
if ($plural) {
- 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 needAliasForClassName
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function needAliasForClassName(string $class, string $classNamespace): bool
{
// Should remove this check by not allowing nullable return values in getNamespace
if ($this->getNamespace() === null) {
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 declareClassNamespace
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function declareClassNamespace(string $class, string $namespace = '', $alias = false): string
{
$namespace = trim($namespace, '\\');
// check if the class is already declared
- 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 getUseStatements
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getUseStatements(?string $ignoredNamespace = null): string
{
$script = '';
$declaredClasses = $this->declaredClasses;
unset($declaredClasses[$ignoredNamespace]);
- 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 getRefRelatedBySuffix
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected static function getRefRelatedBySuffix(ForeignKey $fk): string
{
$relCol = '';
foreach ($fk->getMapping() as $mapping) {
[$localColumn, $foreignValueOrColumn] = $mapping;
- 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 applyBehaviorModifierBase
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function applyBehaviorModifierBase(string $hookName, string $modifier, string &$script, string $tab = ' '): void
{
$modifierGetter = 'get' . $modifier;
foreach ($this->getTable()->getBehaviors() as $behavior) {
$modifier = $behavior->$modifierGetter();
- 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 declareClassNamespace
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function declareClassNamespace(string $class, string $namespace = '', $alias = false): string
{
$namespace = trim($namespace, '\\');
// check if the class is already declared
Method needAliasForClassName
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function needAliasForClassName(string $class, string $classNamespace): bool
{
// Should remove this check by not allowing nullable return values in getNamespace
if ($this->getNamespace() === null) {
return false;
Function clean
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function clean(string $content): string
{
// line feed
$content = str_replace("\r\n", "\n", $content);
- 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 extractCrossInformation
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
CrossForeignKeys $crossFKs,
$crossFKToIgnore,
array &$signature,
array &$shortSignature,
array &$normalizedShortSignature,
Function extractCrossInformation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function extractCrossInformation(
CrossForeignKeys $crossFKs,
$crossFKToIgnore,
array &$signature,
array &$shortSignature,
- 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 getRelatedBySuffix
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected static function getRelatedBySuffix(ForeignKey $fk): string
{
$relCol = '';
foreach ($fk->getMapping() as $mapping) {
- 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
Avoid too many return
statements within this method. Open
return $this->declareClassNamespace($class, $namespace, $autoAliasName);
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return true;
Function getCrossRefFKGetterName
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function getCrossRefFKGetterName(CrossForeignKeys $crossFKs, ForeignKey $excludeFK): string
{
$names = [];
$fks = $crossFKs->getCrossForeignKeys();
- 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"