propelorm/Propel2

View on GitHub

Showing 740 of 740 total issues

Function getAddTableDDL has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAddTableDDL(Table $table): string
    {
        $table = clone $table;
        $tableDescription = $table->hasDescription() ? $this->getCommentLineDDL($table->getDescription()) : '';

Severity: Minor
Found in src/Propel/Generator/Platform/SqlitePlatform.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 getSharedFks has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getSharedFks(Column $fromColumn, Column $toColumn): array
    {
        $sharedKeys = [];

        foreach (['getReferrers', 'getForeignKeys'] as $getFk) {
Severity: Minor
Found in src/Propel/Generator/Platform/Util/MysqlUuidMigrationBuilder.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

Method addJoin has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function addJoin($left, $right, ?string $joinType = null)
    {
        if (is_array($left) && is_array($right)) {
            $conditions = [];
            foreach ($left as $key => $value) {
Severity: Minor
Found in src/Propel/Runtime/ActiveQuery/Criteria.php - About 1 hr to fix

    Method buildJoinCondition has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function buildJoinCondition(Criteria $c): void
        {
            /** @var \Propel\Runtime\ActiveQuery\Criterion\AbstractCriterion|null $joinCondition */
            $joinCondition = null;
            for ($i = 0; $i < $this->count; $i++) {
    Severity: Minor
    Found in src/Propel/Runtime/ActiveQuery/Join.php - About 1 hr to fix

      Method arrayToDOM has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function arrayToDOM(array $array, DOMElement $rootElement, ?string $charset = null): DOMElement
          {
              foreach ($array as $key => $value) {
                  if (is_numeric($key)) {
                      $key = $rootElement->nodeName;
      Severity: Minor
      Found in src/Propel/Runtime/Parser/XmlParser.php - About 1 hr to fix

        Method addFindPks has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function addFindPks(string &$script): void
            {
                $this->declareClasses(
                    '\Propel\Runtime\Collection\Collection',
                    '\Propel\Runtime\Connection\ConnectionInterface',
        Severity: Minor
        Found in src/Propel/Generator/Builder/Om/QueryBuilder.php - About 1 hr to fix

          Method convertDOMElementToArray has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function convertDOMElementToArray(DOMNode $data): array
              {
                  $array = [];
                  $elementNames = [];
                  /** @var \DOMElement $element */
          Severity: Minor
          Found in src/Propel/Runtime/Parser/XmlParser.php - About 1 hr to fix

            Method computeDiff has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function computeDiff(ForeignKey $fromFk, ForeignKey $toFk, bool $caseInsensitive = false): bool
                {
                    // Check for differences in local and remote table
                    $fromDifferentTable = $caseInsensitive ?
                        strtolower($fromFk->getTableName()) !== strtolower($toFk->getTableName()) :
            Severity: Minor
            Found in src/Propel/Generator/Model/Diff/ForeignKeyComparator.php - About 1 hr to fix

              Method addObjectCompute has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function addObjectCompute(ObjectBuilder $builder): string
                  {
                      $conditions = [];
                      if ($this->getParameter('condition')) {
                          $conditions[] = $this->getParameter('condition');

                Method addDoSelect has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Method resolveString has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function resolveString(string $value, array $resolving = [])
                      {
                          /*
                           * %%: to be unescaped
                           * %[^%\s]++%: a parameter
                  Severity: Minor
                  Found in src/Propel/Common/Config/Loader/FileLoader.php - About 1 hr to fix

                    Method addForeignKeys has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function addForeignKeys(Table $table): void
                        {
                            $database = $table->getDatabase();
                    
                            /** @var \PDOStatement $stmt */
                    Severity: Minor
                    Found in src/Propel/Generator/Reverse/SqliteSchemaParser.php - About 1 hr to fix

                      Method addGetPrimaryKeyHash has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function addGetPrimaryKeyHash(string &$script): void
                          {
                              // We have to iterate through all the columns so that we know the offset of the primary
                              // key columns.
                              $n = 0;
                      Severity: Minor
                      Found in src/Propel/Generator/Builder/Om/TableMapBuilder.php - About 1 hr to fix

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

                            protected function parseTables(Database $database, ?Table $filterTable = null): void
                            {
                                $sql = 'SHOW FULL TABLES';
                        
                                if ($filterTable) {
                        Severity: Minor
                        Found in src/Propel/Generator/Reverse/MysqlSchemaParser.php - About 1 hr to fix

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

                              protected function addColumns(Table $table): void
                              {
                                  /** @var \Propel\Runtime\DataFetcher\PDODataFetcher $dataFetcher */
                                  $dataFetcher = $this->dbh->query("sp_columns '" . $table->getName() . "'");
                                  $dataFetcher->setStyle(PDO::FETCH_ASSOC);
                          Severity: Minor
                          Found in src/Propel/Generator/Reverse/MssqlSchemaParser.php - About 1 hr to fix

                            Method addPopulateObject has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected function addPopulateObject(string &$script): void
                                {
                                    $table = $this->getTable();
                                    $script .= "
                                /**
                            Severity: Minor
                            Found in src/Propel/Generator/Builder/Om/TableMapBuilder.php - About 1 hr to fix

                              Method compareIndices has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function compareIndices(bool $caseInsensitive = false): int
                                  {
                                      $indexDifferences = 0;
                                      $fromTableIndices = array_merge($this->getFromTable()->getIndices(), $this->getFromTable()->getUnices());
                                      $toTableIndices = array_merge($this->getToTable()->getIndices(), $this->getToTable()->getUnices());
                              Severity: Minor
                              Found in src/Propel/Generator/Model/Diff/TableComparator.php - About 1 hr to fix

                                Method addSyncParentToChild has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected function addSyncParentToChild(string &$script): void
                                    {
                                        $parentTable = $this->getParentTable();
                                        $parentClass = $this->builder->getClassNameFromBuilder($this->builder->getNewStubObjectBuilder($parentTable));
                                
                                

                                  Method addDeleteDescendants has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      protected function addDeleteDescendants(string &$script): void
                                      {
                                          $objectClassName = $this->builder->getObjectClassName();
                                          $queryClassName = $this->builder->getQueryClassName();
                                          $tableMapClass = $this->builder->getTableMapClass();

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

                                        public function search($element)
                                        {
                                            $hashes = [];
                                            $isActiveRecord = [];
                                            foreach (func_get_args() as $pos => $obj) {
                                    Severity: Minor
                                    Found in src/Propel/Runtime/Collection/ObjectCombinationCollection.php - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language