Showing 740 of 740 total issues
Method getDropTableDDL
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getDropTableDDL(Table $table): string
{
$ret = '';
foreach ($table->getForeignKeys() as $fk) {
$ret .= "
Method appendForeignKeyNode
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function appendForeignKeyNode(ForeignKey $foreignKey, DOMNode $parentNode): void
{
/** @var \DOMElement $foreignKeyNode */
$foreignKeyNode = $parentNode->appendChild($this->document->createElement('foreign-key'));
$foreignKeyNode->setAttribute('foreignTable', $foreignKey->getForeignTableCommonName());
Method getModifyTableDDL
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getModifyTableDDL(TableDiff $tableDiff): string
{
$changedNotEditableThroughDirectDDL = $this->tableAlteringWorkaround && (
$tableDiff->hasModifiedFks()
|| $tableDiff->hasModifiedIndices()
Method queryMethods
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function queryMethods(QueryBuilder $builder): string
{
$this->setBuilder($builder);
$script = '';
Method generateScopePhp
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generateScopePhp(): array
{
$methodSignature = '';
$paramsDoc = '';
$buildScope = '';
Method doUpdate
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function doUpdate($updateValues, ConnectionInterface $con, bool $forceIndividualSaves = false): int
{
if ($forceIndividualSaves) {
if ($updateValues instanceof Criteria) {
throw new LogicException('Parameter #1 `$updateValues` must be an array while `$forceIndividualSaves = true`.');
Method build
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function build(array &$params): PreparedStatementDto
{
$sourceTableNamesCollector = [];
$selectSql = $this->buildSelectClause($sourceTableNamesCollector);
Method addIndexes
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addIndexes(Table $table): void
{
/** @var \PDOStatement $stmt */
$stmt = $this->dbh->query(sprintf('SHOW INDEX FROM %s', $this->getPlatform()->doQuoting($table->getName())));
Method addPrimaryKey
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addPrimaryKey(Table $table, int $oid): void
{
$stmt = $this->dbh->prepare("SELECT
DISTINCT ON(cls.relname)
cls.relname as idxname,
Method addColumnMutatorMethods
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addColumnMutatorMethods(string &$script): void
{
foreach ($this->getTable()->getColumns() as $col) {
if ($col->getType() === PropelTypes::OBJECT) {
$this->addObjectMutator($script, $col);
Method addRefFKSet
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addRefFKSet(string &$script, ForeignKey $refFK): void
{
$relatedName = $this->getRefFKPhpNameAffix($refFK, true);
$relatedObjectClassName = $this->getRefFKPhpNameAffix($refFK, false);
Consider simplifying this complex logical expression. Open
if (
$col->isPrimaryKey()
&& $col->isAutoIncrement()
&& $table->getIdMethod() !== 'none'
&& !$table->isAllowPkInsert()
Consider simplifying this complex logical expression. Open
if (
($this->isNumber($fromSqlType) && $this->isNumber($toSqlType)) ||
($this->isString($fromSqlType) && $this->isString($toSqlType)) ||
($this->isNumber($fromSqlType) && $this->isString($toSqlType)) ||
($this->isUuid($fromSqlType) && $this->isString($toSqlType))
Similar blocks of code found in 2 locations. Consider refactoring. Open
$this
->addOption('mysql-engine', null, InputOption::VALUE_REQUIRED, 'MySQL engine (MyISAM, InnoDB, ...)')
->addOption('schema-dir', null, InputOption::VALUE_REQUIRED, 'The directory where the schema files are placed')
->addOption('output-dir', null, InputOption::VALUE_REQUIRED, 'The output directory')
->addOption('object-class', null, InputOption::VALUE_REQUIRED, 'The object class generator name')
- 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 107.
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
$this
->addOption('mysql-engine', null, InputOption::VALUE_REQUIRED, 'MySQL engine (MyISAM, InnoDB, ...)')
->addOption('schema-dir', null, InputOption::VALUE_REQUIRED, 'The directory where the schema files are placed')
->addOption('output-dir', null, InputOption::VALUE_REQUIRED, 'The output directory')
->addOption('validate', null, InputOption::VALUE_NONE, '')
- 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 107.
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
Method createSelectSqlPart
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createSelectSqlPart(Criteria $criteria, array &$fromClause, bool $aliasAll = false): string
{
$selectClause = [];
if ($aliasAll) {
Method addDelete
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addDelete(string &$script): void
{
$script .= "
/**
* Performs a DELETE on the database based on the current ModelCriteria
Method addFilterByPrimaryKey
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addFilterByPrimaryKey(string &$script): void
{
$script .= "
/**
* Filter the query by primary key
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 getColumnDefaultValueDDL
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getColumnDefaultValueDDL(Column $col): string
{
$default = '';
$defaultValue = $col->getDefaultValue();
if ($defaultValue !== null) {