propelorm/Propel2

View on GitHub

Showing 693 of 740 total issues

Method buildOrderByClause has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function buildOrderByClause(array &$params): array
    {
        $orderBy = $this->criteria->getOrderByColumns();
        if (!$orderBy) {
            return ['', ''];
Severity: Major
Found in src/Propel/Runtime/ActiveQuery/SqlBuilder/SelectQuerySqlBuilder.php - About 2 hrs to fix

    Method equals has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function equals(self $crit): bool
        {
            if ($this === $crit) {
                return true;
            }
    Severity: Major
    Found in src/Propel/Runtime/ActiveQuery/Criteria.php - About 2 hrs to fix

      Method addFilterByRefFk has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function addFilterByRefFk(string &$script, ForeignKey $fk): void
          {
              $this->declareClasses(
                  '\Propel\Runtime\Collection\ObjectCollection',
                  '\Propel\Runtime\Exception\PropelException',
      Severity: Major
      Found in src/Propel/Generator/Builder/Om/QueryBuilder.php - About 2 hrs to fix

        Method addDoInsert has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function addDoInsert(string &$script): void
            {
                $table = $this->getTable();
                $tableMapClass = $this->getTableMapClass();
        
        
        Severity: Major
        Found in src/Propel/Generator/Builder/Om/TableMapBuilder.php - About 2 hrs to fix

          Method addFKMutator has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function addFKMutator(string &$script, ForeignKey $fk): void
              {
                  $fkTable = $fk->getForeignTable();
                  $interface = $fk->getInterface();
          
          
          Severity: Major
          Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

            Method getAddTableDDL has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getAddTableDDL(Table $table): string
                {
                    $lines = [];
            
                    foreach ($table->getColumns() as $column) {
            Severity: Major
            Found in src/Propel/Generator/Platform/MysqlPlatform.php - About 2 hrs to fix

              Method addIndexes has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function addIndexes(Table $table, int $oid): void
                  {
                      $stmt = $this->dbh->prepare("SELECT
                          DISTINCT ON(cls.relname)
                          cls.relname as idxname,
              Severity: Major
              Found in src/Propel/Generator/Reverse/PgsqlSchemaParser.php - About 2 hrs to fix

                Method parseTables has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function parseTables(Database $database, ?Table $filterTable = null): void
                    {
                        $sql = "
                        SELECT name
                        FROM sqlite_master
                Severity: Major
                Found in src/Propel/Generator/Reverse/SqliteSchemaParser.php - About 2 hrs to fix

                  Method addCrossFKCreateQuery has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function addCrossFKCreateQuery(string &$script, CrossForeignKeys $crossFKs): void
                      {
                          if (1 <= count($crossFKs->getCrossForeignKeys()) && !$crossFKs->getUnclassifiedPrimaryKeys()) {
                              return;
                          }
                  Severity: Major
                  Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

                    Method addAddVersion has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function addAddVersion(string &$script): void
                        {
                            $versionTable = $this->behavior->getVersionTable();
                            $versionARClassName = $this->builder->getClassNameFromBuilder($this->builder->getNewStubObjectBuilder($versionTable));
                    
                    

                      Method addVersionTable has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function addVersionTable(): void
                          {
                              $table = $this->getTable();
                              $database = $table->getDatabase();
                              $versionTableName = $this->getParameter('version_table') ?: ($table->getOriginCommonName() . '_version');
                      Severity: Major
                      Found in src/Propel/Generator/Behavior/Versionable/VersionableBehavior.php - About 2 hrs to fix

                        Method addCrossFKSet has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function addCrossFKSet(string &$script, CrossForeignKeys $crossFKs): void
                            {
                                $scheduledForDeletionVarName = $this->getCrossScheduledForDeletionVarName($crossFKs);
                        
                                $multi = 1 < count($crossFKs->getCrossForeignKeys()) || (bool)$crossFKs->getUnclassifiedPrimaryKeys();
                        Severity: Minor
                        Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

                          Method addDoCount has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function addDoCount(string &$script): void
                              {
                                  $script .= "
                          public function doCount(?ConnectionInterface \$con = null): \Propel\Runtime\DataFetcher\DataFetcherInterface
                          {
                          Severity: Minor
                          Found in src/Propel/Generator/Behavior/QueryCache/QueryCacheBehavior.php - About 2 hrs to fix

                            Method __call has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function __call(string $name, array $arguments)
                                {
                                    // Maybe it's a magic call to one of the methods supporting it, e.g. 'findByTitle'
                                    static $methods = ['findBy', 'findOneBy', 'requireOneBy', 'filterBy', 'orderBy', 'groupBy'];
                                    foreach ($methods as $methodName) {
                            Severity: Minor
                            Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 1 hr to fix

                              Method addColumns has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function addColumns(Table $table): void
                                  {
                                      /** @var \PDOStatement $stmt */
                                      $stmt = $this->dbh->query("SELECT COLUMN_NAME, DATA_TYPE, NULLABLE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE, DATA_DEFAULT FROM USER_TAB_COLS WHERE TABLE_NAME = '" . $table->getName() . "'");
                                      while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
                              Severity: Minor
                              Found in src/Propel/Generator/Reverse/OracleSchemaParser.php - About 1 hr to fix

                                Method addRefFKGet has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected function addRefFKGet(string &$script, ForeignKey $refFK): void
                                    {
                                        $fkQueryClassName = $this->getClassNameFromBuilder($this->getNewStubQueryBuilder($refFK->getTable()));
                                        $relCol = $this->getRefFKPhpNameAffix($refFK, true);
                                        $collName = $this->getRefFKCollVarName($refFK);
                                Severity: Minor
                                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

                                  Method isUnique has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function isUnique(array $keys): bool
                                      {
                                          if (count($keys) === 1) {
                                              $column = $keys[0] instanceof Column ? $keys[0] : $this->getColumn($keys[0]);
                                              if ($column) {
                                  Severity: Minor
                                  Found in src/Propel/Generator/Model/Table.php - About 1 hr to fix

                                    Function addMultipleJoin has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        public function addMultipleJoin(array $conditions, ?string $joinType = null)
                                        {
                                            $join = new Join();
                                            $join->setIdentifierQuoting($this->isIdentifierQuotingEnabled());
                                            $joinCondition = null;
                                    Severity: Minor
                                    Found in src/Propel/Runtime/ActiveQuery/Criteria.php - About 1 hr to fix

                                    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 cleanupSQL has a Cognitive Complexity of 15 (exceeds 5 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

                                    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 appendPsForUniqueClauseTo has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        protected function appendPsForUniqueClauseTo(string &$sb, array &$params): void
                                        {
                                            $field = ($this->table === null) ? $this->column : $this->table . '.' . $this->column;
                                            // NULL VALUES need special treatment because the SQL syntax is different
                                            // i.e. table.column IS NULL rather than table.column = null
                                    Severity: Minor
                                    Found in src/Propel/Runtime/ActiveQuery/Criterion/BasicCriterion.php - About 1 hr to fix

                                    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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language