modxcms/revolution

View on GitHub
core/xpdo/om/mysql/xpdomanager.class.php

Summary

Maintainability
F
2 wks
Test Coverage

Function createObjectContainer has a Cognitive Complexity of 157 (exceeds 5 allowed). Consider refactoring.
Open

    public function createObjectContainer($className) {
        $created= false;
        if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
            $instance= $this->xpdo->newObject($className);
            if ($instance) {
Severity: Minor
Found in core/xpdo/om/mysql/xpdomanager.class.php - About 3 days 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

File xpdomanager.class.php has 433 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/*
 * Copyright 2010-2015 by MODX, LLC.
 *
 * This file is part of xPDO.
Severity: Minor
Found in core/xpdo/om/mysql/xpdomanager.class.php - About 6 hrs to fix

    Method createObjectContainer has 138 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function createObjectContainer($className) {
            $created= false;
            if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                $instance= $this->xpdo->newObject($className);
                if ($instance) {
    Severity: Major
    Found in core/xpdo/om/mysql/xpdomanager.class.php - About 5 hrs to fix

      Function alterField has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          public function alterField($class, $name, array $options = array()) {
              $result = false;
              if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                  $className = $this->xpdo->loadClass($class);
                  if ($className) {
      Severity: Minor
      Found in core/xpdo/om/mysql/xpdomanager.class.php - About 3 hrs 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 addField has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          public function addField($class, $name, array $options = array()) {
              $result = false;
              if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                  $className = $this->xpdo->loadClass($class);
                  if ($className) {
      Severity: Minor
      Found in core/xpdo/om/mysql/xpdomanager.class.php - About 3 hrs 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 createSourceContainer has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          public function createSourceContainer($dsnArray = null, $username= null, $password= null, $containerOptions= array ()) {
              $created= false;
              if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                  if ($dsnArray === null) $dsnArray = xPDO::parseDSN($this->xpdo->getOption('dsn'));
                  if ($username === null) $username = $this->xpdo->getOption('username', null, '');
      Severity: Minor
      Found in core/xpdo/om/mysql/xpdomanager.class.php - About 3 hrs 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 removeSourceContainer has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          public function removeSourceContainer($dsnArray = null, $username= null, $password= null) {
              $removed= false;
              if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                  if ($dsnArray === null) $dsnArray = xPDO::parseDSN($this->xpdo->getOption('dsn'));
                  if ($username === null) $username = $this->xpdo->getOption('username', null, '');
      Severity: Minor
      Found in core/xpdo/om/mysql/xpdomanager.class.php - About 2 hrs 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 getIndexDef has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function getIndexDef($class, $name, $meta, array $options = array()) {
              $result = '';
              if (isset($meta['type']) && $meta['type'] == 'FULLTEXT') {
                  $indexType = 'FULLTEXT';
              } else if ( ! empty($meta['primary'])) {
      Severity: Minor
      Found in core/xpdo/om/mysql/xpdomanager.class.php - About 2 hrs 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 addIndex has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          public function addIndex($class, $name, array $options = array()) {
              $result = false;
              if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                  $className = $this->xpdo->loadClass($class);
                  if ($className) {
      Severity: Minor
      Found in core/xpdo/om/mysql/xpdomanager.class.php - About 2 hrs 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 getColumnDef has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function getColumnDef($class, $name, $meta, array $options = array()) {
              $pk= $this->xpdo->getPK($class);
              $pktype= $this->xpdo->getPKType($class);
              $dbtype= strtoupper($meta['dbtype']);
              $lobs= array ('TEXT', 'BLOB');
      Severity: Minor
      Found in core/xpdo/om/mysql/xpdomanager.class.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 getIndexDef has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function getIndexDef($class, $name, $meta, array $options = array()) {
              $result = '';
              if (isset($meta['type']) && $meta['type'] == 'FULLTEXT') {
                  $indexType = 'FULLTEXT';
              } else if ( ! empty($meta['primary'])) {
      Severity: Minor
      Found in core/xpdo/om/mysql/xpdomanager.class.php - About 1 hr to fix

        Method getColumnDef has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function getColumnDef($class, $name, $meta, array $options = array()) {
                $pk= $this->xpdo->getPK($class);
                $pktype= $this->xpdo->getPKType($class);
                $dbtype= strtoupper($meta['dbtype']);
                $lobs= array ('TEXT', 'BLOB');
        Severity: Minor
        Found in core/xpdo/om/mysql/xpdomanager.class.php - About 1 hr to fix

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

              public function addField($class, $name, array $options = array()) {
                  $result = false;
                  if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                      $className = $this->xpdo->loadClass($class);
                      if ($className) {
          Severity: Minor
          Found in core/xpdo/om/mysql/xpdomanager.class.php - About 1 hr to fix

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

                public function alterField($class, $name, array $options = array()) {
                    $result = false;
                    if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                        $className = $this->xpdo->loadClass($class);
                        if ($className) {
            Severity: Minor
            Found in core/xpdo/om/mysql/xpdomanager.class.php - About 1 hr to fix

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

                  public function createSourceContainer($dsnArray = null, $username= null, $password= null, $containerOptions= array ()) {
                      $created= false;
                      if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                          if ($dsnArray === null) $dsnArray = xPDO::parseDSN($this->xpdo->getOption('dsn'));
                          if ($username === null) $username = $this->xpdo->getOption('username', null, '');
              Severity: Minor
              Found in core/xpdo/om/mysql/xpdomanager.class.php - About 1 hr to fix

                Function removeObjectContainer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function removeObjectContainer($className) {
                        $removed= false;
                        if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                            $instance= $this->xpdo->newObject($className);
                            if ($instance) {
                Severity: Minor
                Found in core/xpdo/om/mysql/xpdomanager.class.php - About 55 mins 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 removeIndex has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function removeIndex($class, $name, array $options = array()) {
                        $result = false;
                        if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                            $className = $this->xpdo->loadClass($class);
                            if ($className) {
                Severity: Minor
                Found in core/xpdo/om/mysql/xpdomanager.class.php - About 45 mins 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 removeField has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function removeField($class, $name, array $options = array()) {
                        $result = false;
                        if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                            $className = $this->xpdo->loadClass($class);
                            if ($className) {
                Severity: Minor
                Found in core/xpdo/om/mysql/xpdomanager.class.php - About 45 mins 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

                Consider simplifying this complex logical expression.
                Open

                        if (isset($meta['index']) && $meta['index'] == 'pk' && !is_array($pk) && $pktype == 'integer' && isset ($meta['generated']) && $meta['generated'] == 'native') {
                            $extra= ' AUTO_INCREMENT';
                        }
                Severity: Major
                Found in core/xpdo/om/mysql/xpdomanager.class.php - About 40 mins to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      public function addField($class, $name, array $options = array()) {
                          $result = false;
                          if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                              $className = $this->xpdo->loadClass($class);
                              if ($className) {
                  Severity: Major
                  Found in core/xpdo/om/mysql/xpdomanager.class.php and 1 other location - About 2 days to fix
                  core/xpdo/om/mysql/xpdomanager.class.php on lines 345..376

                  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 430.

                  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

                      public function alterField($class, $name, array $options = array()) {
                          $result = false;
                          if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                              $className = $this->xpdo->loadClass($class);
                              if ($className) {
                  Severity: Major
                  Found in core/xpdo/om/mysql/xpdomanager.class.php and 1 other location - About 2 days to fix
                  core/xpdo/om/mysql/xpdomanager.class.php on lines 284..315

                  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 430.

                  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

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                      public function removeObjectContainer($className) {
                          $removed= false;
                          if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                              $instance= $this->xpdo->newObject($className);
                              if ($instance) {
                  Severity: Major
                  Found in core/xpdo/om/mysql/xpdomanager.class.php and 1 other location - About 1 day to fix
                  core/xpdo/om/sqlsrv/xpdomanager.class.php on lines 105..123

                  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 268.

                  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

                      public function removeIndex($class, $name, array $options = array()) {
                          $result = false;
                          if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                              $className = $this->xpdo->loadClass($class);
                              if ($className) {
                  Severity: Major
                  Found in core/xpdo/om/mysql/xpdomanager.class.php and 1 other location - About 7 hrs to fix
                  core/xpdo/om/mysql/xpdomanager.class.php on lines 386..402

                  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 227.

                  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

                      public function removeField($class, $name, array $options = array()) {
                          $result = false;
                          if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                              $className = $this->xpdo->loadClass($class);
                              if ($className) {
                  Severity: Major
                  Found in core/xpdo/om/mysql/xpdomanager.class.php and 1 other location - About 7 hrs to fix
                  core/xpdo/om/mysql/xpdomanager.class.php on lines 404..420

                  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 227.

                  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 3 locations. Consider refactoring.
                  Open

                                  try {
                                      $pdo = new PDO("mysql:host={$dsnArray['host']}", $username, $password, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
                                      $result = $pdo->exec($sql);
                                      if ($result !== false) {
                                          $created = true;
                  Severity: Major
                  Found in core/xpdo/om/mysql/xpdomanager.class.php and 2 other locations - About 5 hrs to fix
                  core/xpdo/om/mysql/xpdomanager.class.php on lines 85..97
                  core/xpdo/om/sqlsrv/xpdomanager.class.php on lines 56..68

                  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 183.

                  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 3 locations. Consider refactoring.
                  Open

                                  try {
                                      $pdo = new PDO("mysql:host={$dsnArray['host']}", $username, $password, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
                                      $result = $pdo->exec($sql);
                                      if ($result !== false) {
                                          $removed = true;
                  Severity: Major
                  Found in core/xpdo/om/mysql/xpdomanager.class.php and 2 other locations - About 5 hrs to fix
                  core/xpdo/om/mysql/xpdomanager.class.php on lines 57..69
                  core/xpdo/om/sqlsrv/xpdomanager.class.php on lines 56..68

                  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 183.

                  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

                  Identical blocks of code found in 3 locations. Consider refactoring.
                  Open

                                  if ($created === false && $this->xpdo->errorCode() !== '' && $this->xpdo->errorCode() !== PDO::ERR_NONE) {
                                      $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, 'Could not create table ' . $tableName . "\nSQL: {$sql}\nERROR: " . print_r($this->xpdo->errorInfo(), true));
                                  } else {
                                      $created= true;
                                      $this->xpdo->log(xPDO::LOG_LEVEL_INFO, 'Created table ' . $tableName . "\nSQL: {$sql}\n");
                  Severity: Major
                  Found in core/xpdo/om/mysql/xpdomanager.class.php and 2 other locations - About 2 hrs to fix
                  core/xpdo/om/sqlite/xpdomanager.class.php on lines 163..168
                  core/xpdo/om/sqlsrv/xpdomanager.class.php on lines 172..177

                  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 134.

                  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 3 locations. Consider refactoring.
                  Open

                                      if (!empty ($stdIndexes)) {
                                          foreach ($stdIndexes as $indexkey => $index) {
                                              if (is_array($index)) {
                                                  $indexset= array ();
                                                  foreach ($index as $indexmember) {
                  Severity: Major
                  Found in core/xpdo/om/mysql/xpdomanager.class.php and 2 other locations - About 1 hr to fix
                  core/xpdo/om/mysql/xpdomanager.class.php on lines 218..231
                  core/xpdo/om/mysql/xpdomanager.class.php on lines 232..245

                  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 118.

                  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 3 locations. Consider refactoring.
                  Open

                                      if (!empty ($uniqueIndexes)) {
                                          foreach ($uniqueIndexes as $indexkey => $index) {
                                              if (is_array($index)) {
                                                  $indexset= array ();
                                                  foreach ($index as $indexmember) {
                  Severity: Major
                  Found in core/xpdo/om/mysql/xpdomanager.class.php and 2 other locations - About 1 hr to fix
                  core/xpdo/om/mysql/xpdomanager.class.php on lines 204..217
                  core/xpdo/om/mysql/xpdomanager.class.php on lines 232..245

                  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 118.

                  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 3 locations. Consider refactoring.
                  Open

                                      if (!empty ($fulltextIndexes)) {
                                          foreach ($fulltextIndexes as $indexkey => $index) {
                                              if (is_array($index)) {
                                                  $indexset= array ();
                                                  foreach ($index as $indexmember) {
                  Severity: Major
                  Found in core/xpdo/om/mysql/xpdomanager.class.php and 2 other locations - About 1 hr to fix
                  core/xpdo/om/mysql/xpdomanager.class.php on lines 204..217
                  core/xpdo/om/mysql/xpdomanager.class.php on lines 218..231

                  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 118.

                  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

                  Identical blocks of code found in 3 locations. Consider refactoring.
                  Open

                          if (strpos(strtolower($attributes), 'unsigned') !== false) {
                              $result = $this->xpdo->escape($name) . ' ' . $dbtype . $precision . $attributes . $null . $default . $extra;
                          } else {
                              $result = $this->xpdo->escape($name) . ' ' . $dbtype . $precision . $null . $default . $attributes . $extra;
                          }
                  Severity: Major
                  Found in core/xpdo/om/mysql/xpdomanager.class.php and 2 other locations - About 1 hr to fix
                  core/xpdo/om/sqlite/xpdomanager.class.php on lines 320..324
                  core/xpdo/om/sqlsrv/xpdomanager.class.php on lines 417..421

                  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 118.

                  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

                  There are no issues that match your filters.

                  Category
                  Status