Showing 740 of 740 total issues
Method getProfileBetween
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getProfileBetween(array $startSnapshot, array $endSnapshot): string
{
$profile = '';
if ($this->slowThreshold) {
Method simpleXmlToArray
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function simpleXmlToArray(SimpleXMLElement $xml): array
{
$ar = [];
foreach ($xml->children() as $k => $v) {
// recurse the child
Method init
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function init(?ConnectionInterface $con = null): void
{
$this->con = $con;
$maxRecordLimit = $this->getMaxRecordLimit();
$hasMaxRecordLimit = (bool)$maxRecordLimit;
Method addIndexes
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addIndexes(Table $table): void
{
/** @var \Propel\Runtime\DataFetcher\PDODataFetcher $dataFetcher */
$dataFetcher = $this->dbh->query("sp_indexes_rowset '" . $table->getName() . "'");
$dataFetcher->setStyle(PDO::FETCH_ASSOC);
Method addRefFKGetJoinMethods
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addRefFKGetJoinMethods(string &$script, ForeignKey $refFK): void
{
$table = $this->getTable();
$tblFK = $refFK->getTable();
$joinBehavior = $this->getBuildProperty('generator.objectModel.useLeftJoinsInDoJoinMethods') ? 'Criteria::LEFT_JOIN' : 'Criteria::INNER_JOIN';
Method addCrossFKAdd
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addCrossFKAdd(string &$script, CrossForeignKeys $crossFKs): void
{
$refFK = $crossFKs->getIncomingForeignKey();
foreach ($crossFKs->getCrossForeignKeys() as $crossFK) {
Method getConfiguredPlatform
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getConfiguredPlatform(?ConnectionInterface $con = null, ?string $database = null): ?PlatformInterface
{
$platform = $this->get()['generator']['platformClass'];
if ($platform === null) {
Method addObjectGetSyncParent
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addObjectGetSyncParent(string &$script): void
{
$parentTable = $this->getParentTable();
$pkeys = $parentTable->getPrimaryKey();
$cptype = $pkeys[0]->getPhpType();
Method isColumnForeignKeyOrDuplicated
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function isColumnForeignKeyOrDuplicated(Column $column): bool
{
$delegateTable = $column->getTable();
$table = $this->getTable();
$fks = [];
Method moveI18nColumns
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function moveI18nColumns(): void
{
$table = $this->getTable();
$i18nTable = $this->i18nTable;
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($pos) {
$leftTableAlias = substr($left, 0, $pos);
$leftColumnName = substr($left, $pos + 1);
[$leftTableName, $leftTableAlias] = $this->getTableNameAndAlias($leftTableAlias);
} else {
- 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 103.
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 ($pos) {
$rightTableAlias = substr($right, 0, $pos);
$rightColumnName = substr($right, $pos + 1);
[$rightTableName, $rightTableAlias] = $this->getTableNameAndAlias($rightTableAlias);
} else {
- 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 103.
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 addColumn
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
string $name,
string $phpName,
string $type,
bool $isNotNull = false,
?int $size = null,
Method convert
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function convert(string $xmlToParse): array
{
$isFile = file_exists($xmlToParse);
if ($isFile) {
Method cleanupSQL
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function cleanupSQL(string &$sql, array &$params, Criteria $values, DatabaseMap $dbMap): void
{
$i = 1;
$paramCols = [];
foreach ($params as $param) {
Method addInstancePool
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addInstancePool(): string
{
// No need to override instancePool if the PK is not composite
if (!$this->getTable()->hasCompositePrimaryKey()) {
return '';
Method executeRollbackToPreviousVersion
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function executeRollbackToPreviousVersion(int $currentVersion, ?int $previousVersion = null): bool
{
$this->output->writeln(sprintf(
'Executing migration %s down',
$this->migrationManager->getMigrationClassName($currentVersion),
Method addFilterByArrayCol
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function addFilterByArrayCol(string &$script, Column $col): void
{
$singularPhpName = $col->getPhpSingularName();
$colName = $col->getName();
$variableName = $col->getCamelCaseName();
Method mergeStatements
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function mergeStatements(string $sql): string
{
$sqlParser = new SqlParser();
$sqlParser->setSQL($sql);
$statements = $sqlParser->explodeIntoStatements();
Method __construct
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(?array $extraConf = [])
{
if ($extraConf === null) {
$extraConf = [];
}