propelorm/Propel2

View on GitHub

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) {
Severity: Minor
Found in src/Propel/Runtime/Util/Profiler.php - About 1 hr to fix

    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
    Severity: Minor
    Found in src/Propel/Common/Config/XmlToArrayConverter.php - About 1 hr to fix

      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;
      Severity: Minor
      Found in src/Propel/Runtime/Util/PropelModelPager.php - About 1 hr to fix

        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);
        Severity: Minor
        Found in src/Propel/Generator/Reverse/MssqlSchemaParser.php - About 1 hr to fix

          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';
          Severity: Minor
          Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

            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) {
            Severity: Minor
            Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

              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) {
              Severity: Minor
              Found in src/Propel/Generator/Config/GeneratorConfig.php - About 1 hr to fix

                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 = [];
                  Severity: Minor
                  Found in src/Propel/Generator/Behavior/Delegate/DelegateBehavior.php - About 1 hr to fix

                    Method moveI18nColumns has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function moveI18nColumns(): void
                        {
                            $table = $this->getTable();
                            $i18nTable = $this->i18nTable;
                    
                    
                    Severity: Minor
                    Found in src/Propel/Generator/Behavior/I18n/I18nBehavior.php - About 1 hr to fix

                      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 {
                      Severity: Major
                      Found in src/Propel/Runtime/ActiveQuery/Criteria.php and 1 other location - About 1 hr to fix
                      src/Propel/Runtime/ActiveQuery/Criteria.php on lines 1136..1143

                      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

                      Further Reading

                      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 {
                      Severity: Major
                      Found in src/Propel/Runtime/ActiveQuery/Criteria.php and 1 other location - About 1 hr to fix
                      src/Propel/Runtime/ActiveQuery/Criteria.php on lines 1126..1133

                      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

                      Further Reading

                      Method addColumn has 9 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              string $name,
                              string $phpName,
                              string $type,
                              bool $isNotNull = false,
                              ?int $size = null,
                      Severity: Major
                      Found in src/Propel/Runtime/Map/TableMap.php - About 1 hr to fix

                        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) {
                        Severity: Minor
                        Found in src/Propel/Common/Config/XmlToArrayConverter.php - About 1 hr to fix

                          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) {
                          Severity: Minor
                          Found in src/Propel/Runtime/Adapter/Pdo/MssqlAdapter.php - About 1 hr to fix

                            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 '';
                            Severity: Minor
                            Found in src/Propel/Generator/Builder/Om/TableMapBuilder.php - About 1 hr to fix

                              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),
                              Severity: Minor
                              Found in src/Propel/Generator/Command/Executor/RollbackExecutor.php - About 1 hr to fix

                                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();
                                Severity: Minor
                                Found in src/Propel/Generator/Builder/Om/QueryBuilder.php - About 1 hr to fix

                                  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();
                                  Severity: Minor
                                  Found in src/Propel/Generator/Platform/Util/AlterTableStatementMerger.php - About 1 hr to fix

                                    Method __construct has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public function __construct(?array $extraConf = [])
                                        {
                                            if ($extraConf === null) {
                                                $extraConf = [];
                                            }
                                    Severity: Minor
                                    Found in src/Propel/Generator/Config/QuickGeneratorConfig.php - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language