modxcms/revolution

View on GitHub

Showing 7,873 of 7,873 total issues

Avoid deeply nested control flow statements.
Open

                                    if ($this->getDebug() === true) {
                                        $this->log(xPDO::LOG_LEVEL_DEBUG, "Removing all cache objects of class {$gClass}: " . ($removed ? 'successful' : 'failed'));
                                    }
Severity: Major
Found in core/xpdo/xpdo.class.php - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                        if (isset ($v['index']) && isset ($v['phptype']) && $v['index'] == 'pk') {
                                            $pk[$k]= $k;
                                        }
    Severity: Major
    Found in core/xpdo/xpdo.class.php - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if (empty($sigClass) || $sigClass !== $class) {
                                  $sigClass= $class;
                              }
      Severity: Major
      Found in core/xpdo/xpdo.class.php - About 45 mins to fix

        Method generateObject has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function generateObject($obj, $objName, $generateObjVars= false, $generateRelated= false, $objRef= 'this->xpdo', $format= xPDOCacheManager::CACHE_PHP) {
        Severity: Minor
        Found in core/xpdo/cache/xpdocachemanager.class.php - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      if ($payload !== false) {
                                          $payload = $this->xpdo->fromJSON($payload);
                                          if (is_array($payload) && isset($payload['expires']) && (empty($payload['expires']) || time() < $payload['expires'])) {
                                              if (array_key_exists('content', $payload)) {
                                                  $value= $payload['content'];
          Severity: Major
          Found in core/xpdo/cache/xpdocachemanager.class.php - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if (!filesize($cacheKey)) {
                                            $value= false;
                                            break;
                                        }
            Severity: Major
            Found in core/xpdo/cache/xpdocachemanager.class.php - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      while (!is_callable($loader) && $loaderClass = next($callbacks)) {
                                          $loader = array($loaderClass, $method);
                                      }
              Severity: Major
              Found in core/xpdo/xpdo.class.php - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                                    if (isset ($this->map[$ancestorClassName]['fieldMeta'][$k]['phptype'])) {
                                                        if (isset ($v['primary']) && $v['primary'] == true) {
                                                            $pk[$k]= $k;
                                                        }
                                                    }
                Severity: Major
                Found in core/xpdo/xpdo.class.php - About 45 mins to fix

                  Function __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function __construct(& $xpdo, $options = array()) {
                          parent :: __construct($xpdo, $options);
                          if (class_exists('Memcached', true)) {
                              $this->memcached = new Memcached();
                              if ($this->memcached) {
                  Severity: Minor
                  Found in core/xpdo/cache/xpdomemcached.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

                  Avoid deeply nested control flow statements.
                  Open

                                              if ($ts !== false && !empty($value)) {
                                                  if (is_string($format) && !empty ($format)) {
                                                      if (strpos($format, 're:') === 0) {
                                                          $value= date('Y-m-d H:i:s', $ts);
                                                          if (!empty ($formatTemplate) && is_string($formatTemplate)) {
                  Severity: Major
                  Found in core/xpdo/om/xpdoobject.class.php - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                if (is_string($value) && strlen($value) > 1) {
                                                    $value= $this->xpdo->fromJSON($value, true);
                                                }
                    Severity: Major
                    Found in core/xpdo/om/xpdoobject.class.php - About 45 mins to fix

                      Function getTransport has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getTransport() {
                              if ($this->transport === null || !$this->transport instanceof xPDOTransport) {
                                  if (!isset($this->xpdo->config['xPDOTransport.class']) || !$transportClass= $this->xpdo->loadClass($this->xpdo->config['xPDOTransport.class'], '', false, true)) {
                                      $transportClass= $this->xpdo->loadClass('transport.xPDOTransport', XPDO_CORE_PATH, true, true);
                                  }
                      Severity: Minor
                      Found in core/xpdo/om/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

                      Avoid deeply nested control flow statements.
                      Open

                                                  if (is_string($format) && !empty ($format)) {
                                                      if (strpos($format, 're:') === 0) {
                                                          if (!empty ($formatTemplate) && is_string($formatTemplate)) {
                                                              $value= preg_replace(substr($format, 3), $formatTemplate, $value);
                                                          }
                      Severity: Major
                      Found in core/xpdo/om/xpdoobject.class.php - About 45 mins to fix

                        Function createSourceContainer has a Cognitive Complexity of 8 (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))) {
                                    $this->xpdo->log(xPDO::LOG_LEVEL_WARN, 'SQLite does not support source container creation');
                                    if ($dsnArray === null) $dsnArray = xPDO::parseDSN($this->xpdo->getOption('dsn'));
                        Severity: Minor
                        Found in core/xpdo/om/sqlite/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

                        Avoid deeply nested control flow statements.
                        Open

                                                        if ($cardinality == 'many') {
                                                            $newPk= $obj->getPrimaryKey();
                                                            if (is_array($newPk)) $newPk= implode('-', $newPk);
                                                            if ($pk != $newPk) {
                                                                $this->_relatedObjects[$alias][$newPk]= $obj;
                        Severity: Major
                        Found in core/xpdo/om/xpdoobject.class.php - About 45 mins to fix

                          Method leftJoin has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public function leftJoin($class, $alias= '', $conditions= array (), $conjunction= xPDOQuery::SQL_AND, $binding= null, $condGroup= 0) {
                          Severity: Minor
                          Found in core/xpdo/om/xpdoquery.class.php - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if (!empty($localCriteria)) {
                                                        $conditions = array($localCriteria, $conditions);
                                                    }
                            Severity: Major
                            Found in core/xpdo/om/xpdoquery.class.php - About 45 mins to fix

                              Method innerJoin has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  public function innerJoin($class, $alias= '', $conditions= array (), $conjunction= xPDOQuery::SQL_AND, $binding= null, $condGroup= 0) {
                              Severity: Minor
                              Found in core/xpdo/om/xpdoquery.class.php - About 45 mins to fix

                                Method rightJoin has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    public function rightJoin($class, $alias= '', $conditions= array (), $conjunction= xPDOQuery::SQL_AND, $binding= null, $condGroup= 0) {
                                Severity: Minor
                                Found in core/xpdo/om/xpdoquery.class.php - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if (is_array($fkMeta['criteria']['local'])) {
                                                              foreach ($fkMeta['criteria']['local'] as $critKey => $critVal) {
                                                                  if (is_numeric($critKey)) {
                                                                      $localCriteria[] = $critVal;
                                                                  } else {
                                  Severity: Major
                                  Found in core/xpdo/om/xpdoquery.class.php - About 45 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language