modxcms/revolution

View on GitHub
core/xpdo/xpdo.class.php

Summary

Maintainability
F
1 mo
Test Coverage

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

<?php
/*
 * OpenExpedio ("xPDO") is an ultra-light, PHP 5.2+ compatible ORB (Object-
 * Relational Bridge) library based around PDO (http://php.net/pdo/).
 *
Severity: Major
Found in core/xpdo/xpdo.class.php - About 5 days to fix

    Function toCache has a Cognitive Complexity of 120 (exceeds 5 allowed). Consider refactoring.
    Open

        public function toCache($signature, $object, $lifetime= 0, $options = array()) {
            $result= false;
            if ($this->getCacheManager()) {
                if ($this->getOption(xPDO::OPT_CACHE_DB, $options)) {
                    if ($lifetime === true) {
    Severity: Minor
    Found in core/xpdo/xpdo.class.php - About 2 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

    Function getPK has a Cognitive Complexity of 108 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getPK($className) {
            $pk= null;
            if (strcasecmp($className, 'xPDOObject') !== 0) {
                if ($actualClassName= $this->loadClass($className)) {
                    if (isset ($this->map[$actualClassName]['indexes'])) {
    Severity: Minor
    Found in core/xpdo/xpdo.class.php - About 2 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

    xPDO has 89 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class xPDO {
        /**#@+
         * Constants
         */
        const OPT_AUTO_CREATE_TABLES = 'auto_create_tables';
    Severity: Major
    Found in core/xpdo/xpdo.class.php - About 1 day to fix

      Function fromCache has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
      Open

          public function fromCache($signature, $class= '', $options= array()) {
              $result= null;
              if ($this->getOption(xPDO::OPT_CACHE_DB, $options)) {
                  if ($signature && $this->getCacheManager()) {
                      $sig= '';
      Severity: Minor
      Found in core/xpdo/xpdo.class.php - About 1 day 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 loadClass has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
      Open

          public function loadClass($fqn, $path= '', $ignorePkg= false, $transient= false) {
              if (empty($fqn)) {
                  $this->log(xPDO::LOG_LEVEL_ERROR, "No class specified for loadClass");
                  return false;
              }
      Severity: Minor
      Found in core/xpdo/xpdo.class.php - About 5 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 updateCollection has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

          public function updateCollection($className, array $set, $criteria= null) {
              $affected = false;
              if ($this->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                  $query = $this->newQuery($className);
                  if ($query && !empty($set)) {
      Severity: Minor
      Found in core/xpdo/xpdo.class.php - About 5 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 removeObject has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

          public function removeObject($className, $criteria) {
              $removed= false;
              if ($this->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                  if ($this->getCount($className, $criteria) === 1) {
                      if ($query= $this->newQuery($className)) {
      Severity: Minor
      Found in core/xpdo/xpdo.class.php - About 5 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 escSplit has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function escSplit($char, $str, $escToken = '`', $limit = 0) {
              $split= array();
              $charPos = strpos($str, $char);
              if ($charPos !== false) {
                  if ($charPos === 0) {
      Severity: Minor
      Found in core/xpdo/xpdo.class.php - About 4 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 getIndexMeta has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getIndexMeta($className) {
              $indices= array();
              if ($className= $this->loadClass($className)) {
                  if ($ancestry= $this->getAncestry($className)) {
                      for ($i= count($ancestry) -1; $i >= 0; $i--) {
      Severity: Minor
      Found in core/xpdo/xpdo.class.php - About 4 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 __construct has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          public function __construct($dsn, $username= '', $password= '', $options= array(), $driverOptions= null) {
              try {
                  $this->config = $this->initConfig($options);
                  $this->setLogLevel($this->getOption('log_level', null, xPDO::LOG_LEVEL_FATAL, true));
                  $this->setLogTarget($this->getOption('log_target', null, XPDO_CLI_MODE ? 'ECHO' : 'HTML', true));
      Severity: Minor
      Found in core/xpdo/xpdo.class.php - About 4 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 getTableName has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getTableName($className, $includeDb= false) {
              $table= null;
              if ($className= $this->loadClass($className)) {
                  if (isset ($this->map[$className]['table'])) {
                      $table= $this->map[$className]['table'];
      Severity: Minor
      Found in core/xpdo/xpdo.class.php - About 4 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 parseBindings has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          public function parseBindings($sql, $bindings) {
              if (!empty($sql) && !empty($bindings)) {
                  $bound = array();
                  foreach ($bindings as $k => $param) {
                      if (!is_array($param)) {
      Severity: Minor
      Found in core/xpdo/xpdo.class.php - About 4 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 getValidationRules has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getValidationRules($className) {
              $rules= array();
              if ($className= $this->loadClass($className)) {
                  if ($ancestry= $this->getAncestry($className)) {
                      for ($i= count($ancestry) - 1; $i >= 0; $i--) {
      Severity: Minor
      Found in core/xpdo/xpdo.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

      Method toCache has 94 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function toCache($signature, $object, $lifetime= 0, $options = array()) {
              $result= false;
              if ($this->getCacheManager()) {
                  if ($this->getOption(xPDO::OPT_CACHE_DB, $options)) {
                      if ($lifetime === true) {
      Severity: Major
      Found in core/xpdo/xpdo.class.php - About 3 hrs to fix

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

            protected function _log($level, $msg, $target= '', $def= '', $file= '', $line= '') {
                if ($level !== xPDO::LOG_LEVEL_FATAL && $level > $this->logLevel && $this->_debug !== true) {
                    return;
                }
                if (empty ($target)) {
        Severity: Minor
        Found in core/xpdo/xpdo.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 getFieldAliases has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getFieldAliases($className) {
                $fieldAliases= array ();
                if ($className= $this->loadClass($className)) {
                    if ($ancestry= $this->getAncestry($className)) {
                        for ($i= count($ancestry) - 1; $i >= 0; $i--) {
        Severity: Minor
        Found in core/xpdo/xpdo.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 getFieldMeta has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getFieldMeta($className, $includeExtended = false) {
                $fieldMeta= array ();
                if ($className= $this->loadClass($className)) {
                    if ($ancestry= $this->getAncestry($className)) {
                        for ($i= count($ancestry) - 1; $i >= 0; $i--) {
        Severity: Minor
        Found in core/xpdo/xpdo.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 getFields has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getFields($className) {
                $fields= array ();
                if ($className= $this->loadClass($className)) {
                    if ($ancestry= $this->getAncestry($className)) {
                        for ($i= count($ancestry) - 1; $i >= 0; $i--) {
        Severity: Minor
        Found in core/xpdo/xpdo.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 getComposites has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getComposites($className) {
                $composites= array ();
                if ($className= $this->loadClass($className)) {
                    if ($ancestry= $this->getAncestry($className)) {
                        for ($i= count($ancestry) - 1; $i >= 0; $i--) {
        Severity: Minor
        Found in core/xpdo/xpdo.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 getAggregates has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getAggregates($className) {
                $aggregates= array ();
                if ($className= $this->loadClass($className)) {
                    if ($ancestry= $this->getAncestry($className)) {
                        for ($i= count($ancestry) - 1; $i >= 0; $i--) {
        Severity: Minor
        Found in core/xpdo/xpdo.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 removeCollection has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            public function removeCollection($className, $criteria) {
                $removed= false;
                if ($this->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                    if ($query= $this->newQuery($className)) {
                        $query->command('DELETE');
        Severity: Minor
        Found in core/xpdo/xpdo.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 getOption has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getOption($key, $options = null, $default = null, $skipEmpty = false) {
                $option = null;
                if (is_string($key) && !empty($key)) {
                    $found = false;
                    if (isset($options[$key])) {
        Severity: Minor
        Found in core/xpdo/xpdo.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 addDerivativeCriteria has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            public function addDerivativeCriteria($className, $criteria) {
                if ($criteria instanceof xPDOQuery && !isset($this->map[$className]['table'])) {
                    if (isset($this->map[$className]['fields']['class_key']) && !empty($this->map[$className]['fields']['class_key'])) {
                        $criteria->where(array('class_key' => $this->map[$className]['fields']['class_key']));
                        if ($this->getDebug() === true) {
        Severity: Minor
        Found in core/xpdo/xpdo.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 getPKType has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getPKType($className, $pk= false) {
                $pktype= null;
                if ($actualClassName= $this->loadClass($className)) {
                    if (!$pk)
                        $pk= $this->getPK($actualClassName);
        Severity: Minor
        Found in core/xpdo/xpdo.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

        Method _log has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function _log($level, $msg, $target= '', $def= '', $file= '', $line= '') {
                if ($level !== xPDO::LOG_LEVEL_FATAL && $level > $this->logLevel && $this->_debug !== true) {
                    return;
                }
                if (empty ($target)) {
        Severity: Major
        Found in core/xpdo/xpdo.class.php - About 2 hrs to fix

          Function getConnection has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              public function &getConnection(array $options = array()) {
                  $conn =& $this->connection;
                  $mutable = $this->getOption(xPDO::OPT_CONN_MUTABLE, $options, null);
                  if (!($conn instanceof xPDOConnection) || ($mutable !== null && (($mutable == true && !$conn->isMutable()) || ($mutable == false && $conn->isMutable())))) {
                      if (!empty($this->_connections)) {
          Severity: Minor
          Found in core/xpdo/xpdo.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 _loadClass has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function _loadClass($class, $fqn, $included= false, $path= '', $transient= false) {
                  if (empty($path)) $path= XPDO_CORE_PATH;
                  if (!$included) {
                      /* turn to filesystem path and enforce all lower-case paths and filenames */
                      $fqcn= str_replace('.', '/', $fqn) . '.class.php';
          Severity: Minor
          Found in core/xpdo/xpdo.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 getTableMeta has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getTableMeta($className) {
                  $tableMeta= null;
                  if ($className= $this->loadClass($className)) {
                      if (isset ($this->map[$className]['tableMeta'])) {
                          $tableMeta= $this->map[$className]['tableMeta'];
          Severity: Minor
          Found in core/xpdo/xpdo.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 setPackageMeta has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              public function setPackageMeta($pkg, $path = '') {
                  $set = false;
                  if (is_string($pkg) && !empty($pkg)) {
                      $pkgPath = str_replace('.', '/', $pkg);
                      $mapFile = $path . $pkgPath . '/metadata.' . $this->config['dbtype'] . '.php';
          Severity: Minor
          Found in core/xpdo/xpdo.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 connect has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              public function connect($driverOptions = array()) {
                  if ($this->pdo === null) {
                      if (is_array($driverOptions) && !empty($driverOptions)) {
                          $this->config['driverOptions']= $driverOptions + $this->config['driverOptions'];
                      }
          Severity: Minor
          Found in core/xpdo/xpdo.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 getCount has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getCount($className, $criteria = null) {
                  $count = 0;
                  if ($query = $this->newQuery($className, $criteria)) {
                      $stmt = null;
                      $expr = '*';
          Severity: Minor
          Found in core/xpdo/xpdo.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 getInherit has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getInherit($className) {
                  $inherit= false;
                  if ($className= $this->loadClass($className)) {
                      if (isset ($this->map[$className]['inherit'])) {
                          $inherit= $this->map[$className]['inherit'];
          Severity: Minor
          Found in core/xpdo/xpdo.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 getTableClass has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getTableClass($className) {
                  $tableClass= null;
                  if ($className= $this->loadClass($className)) {
                      if (isset ($this->map[$className]['table'])) {
                          $tableClass= $className;
          Severity: Minor
          Found in core/xpdo/xpdo.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

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

              public function __construct($dsn, $username= '', $password= '', $options= array(), $driverOptions= null) {
                  try {
                      $this->config = $this->initConfig($options);
                      $this->setLogLevel($this->getOption('log_level', null, xPDO::LOG_LEVEL_FATAL, true));
                      $this->setLogTarget($this->getOption('log_target', null, XPDO_CLI_MODE ? 'ECHO' : 'HTML', true));
          Severity: Major
          Found in core/xpdo/xpdo.class.php - About 2 hrs to fix

            Function getObjectLoader has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getObjectLoader($className, $method) {
                    $loader = false;
                    if (isset($this->config[xPDO::OPT_LOADER_CLASSES]) && is_array($this->config[xPDO::OPT_LOADER_CLASSES])) {
                        if ($ancestry = $this->getAncestry($className, true)) {
                            if ($callbacks = array_intersect($ancestry, $this->config[xPDO::OPT_LOADER_CLASSES])) {
            Severity: Minor
            Found in core/xpdo/xpdo.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

            Method loadClass has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function loadClass($fqn, $path= '', $ignorePkg= false, $transient= false) {
                    if (empty($fqn)) {
                        $this->log(xPDO::LOG_LEVEL_ERROR, "No class specified for loadClass");
                        return false;
                    }
            Severity: Major
            Found in core/xpdo/xpdo.class.php - About 2 hrs to fix

              Function bind has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function bind($bindings= array (), $byValue= true, $cacheFlag= false) {
                      if (!empty ($bindings)) {
                          $this->bindings= array_merge($this->bindings, $bindings);
                      }
                      if (is_object($this->stmt) && $this->stmt && !empty ($this->bindings)) {
              Severity: Minor
              Found in core/xpdo/xpdo.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 getService has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function &getService($name, $class= '', $path= '', $params= array ()) {
                      $service= null;
                      if (!isset ($this->services[$name]) || !is_object($this->services[$name])) {
                          if (empty ($class) && isset ($this->config[$name . '.class'])) {
                              $class= $this->config[$name . '.class'];
              Severity: Minor
              Found in core/xpdo/xpdo.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

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

                  public function fromCache($signature, $class= '', $options= array()) {
                      $result= null;
                      if ($this->getOption(xPDO::OPT_CACHE_DB, $options)) {
                          if ($signature && $this->getCacheManager()) {
                              $sig= '';
              Severity: Major
              Found in core/xpdo/xpdo.class.php - About 2 hrs to fix

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

                    public function getPK($className) {
                        $pk= null;
                        if (strcasecmp($className, 'xPDOObject') !== 0) {
                            if ($actualClassName= $this->loadClass($className)) {
                                if (isset ($this->map[$actualClassName]['indexes'])) {
                Severity: Major
                Found in core/xpdo/xpdo.class.php - About 2 hrs to fix

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

                      public function parseBindings($sql, $bindings) {
                          if (!empty($sql) && !empty($bindings)) {
                              $bound = array();
                              foreach ($bindings as $k => $param) {
                                  if (!is_array($param)) {
                  Severity: Minor
                  Found in core/xpdo/xpdo.class.php - About 1 hr to fix

                    Function getPackage has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getPackage($className) {
                            $package= '';
                            if ($className= $this->loadClass($className)) {
                                if (isset($this->map[$className]['package'])) {
                                    $package= $this->map[$className]['package'];
                    Severity: Minor
                    Found in core/xpdo/xpdo.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 updateCollection has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function updateCollection($className, array $set, $criteria= null) {
                            $affected = false;
                            if ($this->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                                $query = $this->newQuery($className);
                                if ($query && !empty($set)) {
                    Severity: Minor
                    Found in core/xpdo/xpdo.class.php - About 1 hr to fix

                      Function getFKDefinition has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          function getFKDefinition($parentClass, $alias) {
                              $def= null;
                              $parentClass= $this->loadClass($parentClass);
                              if ($parentClass && $alias) {
                                  if ($aggregates= $this->getAggregates($parentClass)) {
                      Severity: Minor
                      Found in core/xpdo/xpdo.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 escSplit has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function escSplit($char, $str, $escToken = '`', $limit = 0) {
                              $split= array();
                              $charPos = strpos($str, $char);
                              if ($charPos !== false) {
                                  if ($charPos === 0) {
                      Severity: Minor
                      Found in core/xpdo/xpdo.class.php - About 1 hr to fix

                        Function addPackage has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function addPackage($pkg= '', $path= '', $prefix= null) {
                                $added= false;
                                if (is_string($pkg) && !empty($pkg)) {
                                    if (!is_string($path) || empty($path)) {
                                        $this->log(xPDO::LOG_LEVEL_ERROR, "Invalid path specified for package: {$pkg}; using default xpdo model path: " . XPDO_CORE_PATH . 'om/');
                        Severity: Minor
                        Found in core/xpdo/xpdo.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

                        Function sanitizePKCriteria has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function sanitizePKCriteria($className, &$criteria) {
                                if (is_scalar($criteria)) {
                                    $pkType = $this->getPKType($className);
                                    if (is_string($pkType)) {
                                        $pk = $this->getPK($className);
                        Severity: Minor
                        Found in core/xpdo/xpdo.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

                        Function fromJSON has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function fromJSON($src, $asArray= true) {
                                $decoded= '';
                                if ($src) {
                                    if (!function_exists('json_decode')) {
                                        if (@ include_once (XPDO_CORE_PATH . 'json/JSON.php')) {
                        Severity: Minor
                        Found in core/xpdo/xpdo.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

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

                            public function call($class, $method, array $args = array(), $transient = false) {
                                $return = null;
                                $callback = '';
                                if ($transient) {
                                    $className = $this->loadClass($class, '', false, true);
                        Severity: Minor
                        Found in core/xpdo/xpdo.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

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

                            public function getGraph($className, $depth= 3, &$parents = array(), &$visited = array()) {
                                $graph = array();
                                $className = $this->loadClass($className);
                                if ($className && $depth > 0) {
                                    $depth--;
                        Severity: Minor
                        Found in core/xpdo/xpdo.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 getTableName has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getTableName($className, $includeDb= false) {
                                $table= null;
                                if ($className= $this->loadClass($className)) {
                                    if (isset ($this->map[$className]['table'])) {
                                        $table= $this->map[$className]['table'];
                        Severity: Minor
                        Found in core/xpdo/xpdo.class.php - About 1 hr to fix

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

                              public function removeObject($className, $criteria) {
                                  $removed= false;
                                  if ($this->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                                      if ($this->getCount($className, $criteria) === 1) {
                                          if ($query= $this->newQuery($className)) {
                          Severity: Minor
                          Found in core/xpdo/xpdo.class.php - About 1 hr to fix

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

                                public function getCount($className, $criteria = null) {
                                    $count = 0;
                                    if ($query = $this->newQuery($className, $criteria)) {
                                        $stmt = null;
                                        $expr = '*';
                            Severity: Minor
                            Found in core/xpdo/xpdo.class.php - About 1 hr to fix

                              Function getInstance has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public static function getInstance($id = null, $config = null, $forceNew = false) {
                                      $instances =& self::$instances;
                                      if (is_null($id)) {
                                          if (!is_null($config) || $forceNew || empty($instances)) {
                                              $id = uniqid(__CLASS__);
                              Severity: Minor
                              Found in core/xpdo/xpdo.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

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

                                  function __construct(& $xpdo, array $options= array()) {
                                      $this->xpdo =& $xpdo;
                                      if (isset($options['class'])) {
                                          $this->class = $this->xpdo->loadClass($options['class']);
                                      }
                              Severity: Minor
                              Found in core/xpdo/xpdo.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 connect has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function connect($driverOptions = array()) {
                                      if ($this->pdo === null) {
                                          if (is_array($driverOptions) && !empty($driverOptions)) {
                                              $this->config['driverOptions']= $driverOptions + $this->config['driverOptions'];
                                          }
                              Severity: Minor
                              Found in core/xpdo/xpdo.class.php - About 1 hr to fix

                                Method getService has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function &getService($name, $class= '', $path= '', $params= array ()) {
                                        $service= null;
                                        if (!isset ($this->services[$name]) || !is_object($this->services[$name])) {
                                            if (empty ($class) && isset ($this->config[$name . '.class'])) {
                                                $class= $this->config[$name . '.class'];
                                Severity: Minor
                                Found in core/xpdo/xpdo.class.php - About 1 hr to fix

                                  Method getOption has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function getOption($key, $options = null, $default = null, $skipEmpty = false) {
                                          $option = null;
                                          if (is_string($key) && !empty($key)) {
                                              $found = false;
                                              if (isset($options[$key])) {
                                  Severity: Minor
                                  Found in core/xpdo/xpdo.class.php - About 1 hr to fix

                                    Method removeCollection has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public function removeCollection($className, $criteria) {
                                            $removed= false;
                                            if ($this->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                                                if ($query= $this->newQuery($className)) {
                                                    $query->command('DELETE');
                                    Severity: Minor
                                    Found in core/xpdo/xpdo.class.php - About 1 hr to fix

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

                                          public function getDebugBacktrace() {
                                              $backtrace= array ();
                                              foreach (debug_backtrace() as $levelKey => $levelElement) {
                                                  foreach ($levelElement as $traceKey => $traceElement) {
                                                      if ($traceKey == 'object' && $traceElement instanceof xPDOObject) {
                                      Severity: Minor
                                      Found in core/xpdo/xpdo.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

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

                                          public function log($level, $msg, $target= '', $def= '', $file= '', $line= '') {
                                      Severity: Minor
                                      Found in core/xpdo/xpdo.class.php - About 45 mins to fix

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

                                            protected function _log($level, $msg, $target= '', $def= '', $file= '', $line= '') {
                                        Severity: Minor
                                        Found in core/xpdo/xpdo.class.php - About 45 mins to fix

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

                                              public function __construct(xPDO &$xpdo, $dsn, $username= '', $password= '', $options= array(), $driverOptions= array()) {
                                          Severity: Minor
                                          Found in core/xpdo/xpdo.class.php - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                                        if ($descendantClass && isset($this->map[$descendantClass]['indexes'])) {
                                                                            $indices= array_merge($indices, array_diff_key($this->map[$descendantClass]['indexes'], $indices));
                                                                        }
                                            Severity: Major
                                            Found in core/xpdo/xpdo.class.php - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                                          while ($key= next($exploded)) {
                                                                              $sigKey[]= $key;
                                                                          }
                                              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 = $signature->getTableClass();
                                                Severity: Major
                                                Found in core/xpdo/xpdo.class.php - About 45 mins to fix

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                                          if (empty($sigKey)) {
                                                                              while ($key= next($exploded)) {
                                                                                  $sigKey[]= $key;
                                                                              }
                                                                          }
                                                  Severity: Major
                                                  Found in core/xpdo/xpdo.class.php - About 45 mins to fix

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                                            if ($signature instanceof xPDOQuery) {
                                                                                $signature->construct();
                                                                                if (empty($sigClass)) $sigClass= $signature->getTableClass();
                                                                            }
                                                    Severity: Major
                                                    Found in core/xpdo/xpdo.class.php - About 45 mins to fix

                                                      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

                                                            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

                                                                Consider simplifying this complex logical expression.
                                                                Open

                                                                        if ($target=='FILE' && $this->getCacheManager()) {
                                                                            $filename = isset($targetOptions['filename']) ? $targetOptions['filename'] : 'error.log';
                                                                            $filepath = isset($targetOptions['filepath']) ? $targetOptions['filepath'] : $this->getCachePath() . xPDOCacheManager::LOG_DIR;
                                                                            $this->cacheManager->writeFile($filepath . $filename, $content, 'a');
                                                                        } elseif ($target=='ARRAY' && isset($targetOptions['var']) && is_array($targetOptions['var'])) {
                                                                Severity: Major
                                                                Found in core/xpdo/xpdo.class.php - About 40 mins to fix

                                                                  Consider simplifying this complex logical expression.
                                                                  Open

                                                                          if (!($conn instanceof xPDOConnection) || ($mutable !== null && (($mutable == true && !$conn->isMutable()) || ($mutable == false && $conn->isMutable())))) {
                                                                              if (!empty($this->_connections)) {
                                                                                  shuffle($this->_connections);
                                                                                  $conn = reset($this->_connections);
                                                                                  while ($conn) {
                                                                  Severity: Major
                                                                  Found in core/xpdo/xpdo.class.php - About 40 mins to fix

                                                                    Method addConnection has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                    Open

                                                                        public function addConnection($dsn, $username= '', $password= '', array $options= array(), $driverOptions= null) {
                                                                    Severity: Minor
                                                                    Found in core/xpdo/xpdo.class.php - About 35 mins to fix

                                                                      Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                      Open

                                                                          public function __construct($dsn, $username= '', $password= '', $options= array(), $driverOptions= null) {
                                                                      Severity: Minor
                                                                      Found in core/xpdo/xpdo.class.php - About 35 mins to fix

                                                                        Method _loadClass has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                        Open

                                                                            protected function _loadClass($class, $fqn, $included= false, $path= '', $transient= false) {
                                                                        Severity: Minor
                                                                        Found in core/xpdo/xpdo.class.php - About 35 mins to fix

                                                                          Method getSelectColumns has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                          Open

                                                                              public function getSelectColumns($className, $tableAlias= '', $columnPrefix= '', $columns= array (), $exclude= false) {
                                                                          Severity: Minor
                                                                          Found in core/xpdo/xpdo.class.php - About 35 mins to fix

                                                                            Function toJSON has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                                public function toJSON($array) {
                                                                                    $encoded= '';
                                                                                    if (is_array ($array)) {
                                                                                        if (!function_exists('json_encode')) {
                                                                                            if (@ include_once (XPDO_CORE_PATH . 'json/JSON.php')) {
                                                                            Severity: Minor
                                                                            Found in core/xpdo/xpdo.class.php - About 35 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 __construct has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                                public function __construct(& $xpdo, $sql= '', $bindings= array (), $cacheFlag= false) {
                                                                                    $this->xpdo= & $xpdo;
                                                                                    $this->cacheFlag= $cacheFlag;
                                                                                    if (is_string($sql) && !empty ($sql)) {
                                                                                        $this->sql= $sql;
                                                                            Severity: Minor
                                                                            Found in core/xpdo/xpdo.class.php - About 35 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 parseDSN has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                                public static function parseDSN($string) {
                                                                                    $result= array ();
                                                                                    $pos= strpos($string, ':');
                                                                                    $result['dbtype']= strtolower(substr($string, 0, $pos));
                                                                                    $parameters= explode(';', substr($string, ($pos +1)));
                                                                            Severity: Minor
                                                                            Found in core/xpdo/xpdo.class.php - About 35 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 getAncestry has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                                public function getAncestry($className, $includeSelf= true) {
                                                                                    $ancestry= array ();
                                                                                    if ($actualClassName= $this->loadClass($className)) {
                                                                                        $ancestor= $actualClassName;
                                                                                        if ($includeSelf) {
                                                                            Severity: Minor
                                                                            Found in core/xpdo/xpdo.class.php - About 35 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 newObject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                                public function newObject($className, $fields= array ()) {
                                                                                    $instance= null;
                                                                                    if ($className= $this->loadClass($className)) {
                                                                                        $className .=  '_' . $this->config['dbtype'];
                                                                                        if ($instance= new $className ($this)) {
                                                                            Severity: Minor
                                                                            Found in core/xpdo/xpdo.class.php - About 35 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 getDriver has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                                public function getDriver() {
                                                                                    if ($this->driver === null || !$this->driver instanceof xPDODriver) {
                                                                                        $loaded= include_once(XPDO_CORE_PATH . 'om/' . $this->config['dbtype'] . '/xpdodriver.class.php');
                                                                                        if ($loaded) {
                                                                                            $driverClass = 'xPDODriver_' . $this->config['dbtype'];
                                                                            Severity: Minor
                                                                            Found in core/xpdo/xpdo.class.php - About 25 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 getDescendants has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                                public function getDescendants($className) {
                                                                                    $descendants = array();
                                                                                    if (isset($this->classMap[$className])) {
                                                                                        $descendants = $this->classMap[$className];
                                                                                        if ($descendants) {
                                                                            Severity: Minor
                                                                            Found in core/xpdo/xpdo.class.php - About 25 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 getManager has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                                public function getManager() {
                                                                                    if ($this->manager === null || !$this->manager instanceof xPDOManager) {
                                                                                        $loaded= include_once(XPDO_CORE_PATH . 'om/' . $this->config['dbtype'] . '/xpdomanager.class.php');
                                                                                        if ($loaded) {
                                                                                            $managerClass = 'xPDOManager_' . $this->config['dbtype'];
                                                                            Severity: Minor
                                                                            Found in core/xpdo/xpdo.class.php - About 25 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 fetch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                                protected function fetch() {
                                                                                    $row = $this->stmt->fetch(PDO::FETCH_ASSOC);
                                                                                    if (is_array($row) && !empty($row)) {
                                                                                        $instance = $this->xpdo->call($this->class, '_loadInstance', array(& $this->xpdo, $this->class, $this->alias, $row));
                                                                                        if ($instance === null) {
                                                                            Severity: Minor
                                                                            Found in core/xpdo/xpdo.class.php - About 25 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 getValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                            Open

                                                                                public function getValue($stmt, $column= null) {
                                                                                    $value = null;
                                                                                    if (is_object($stmt) && $stmt instanceof PDOStatement) {
                                                                                        $tstart = microtime(true);
                                                                                        if ($stmt->execute()) {
                                                                            Severity: Minor
                                                                            Found in core/xpdo/xpdo.class.php - About 25 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

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

                                                                                public function getFields($className) {
                                                                                    $fields= array ();
                                                                                    if ($className= $this->loadClass($className)) {
                                                                                        if ($ancestry= $this->getAncestry($className)) {
                                                                                            for ($i= count($ancestry) - 1; $i >= 0; $i--) {
                                                                            Severity: Major
                                                                            Found in core/xpdo/xpdo.class.php and 3 other locations - About 7 hrs to fix
                                                                            core/xpdo/xpdo.class.php on lines 1465..1488
                                                                            core/xpdo/xpdo.class.php on lines 1667..1690
                                                                            core/xpdo/xpdo.class.php on lines 1698..1721

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

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

                                                                                public function getAggregates($className) {
                                                                                    $aggregates= array ();
                                                                                    if ($className= $this->loadClass($className)) {
                                                                                        if ($ancestry= $this->getAncestry($className)) {
                                                                                            for ($i= count($ancestry) - 1; $i >= 0; $i--) {
                                                                            Severity: Major
                                                                            Found in core/xpdo/xpdo.class.php and 3 other locations - About 7 hrs to fix
                                                                            core/xpdo/xpdo.class.php on lines 1395..1418
                                                                            core/xpdo/xpdo.class.php on lines 1465..1488
                                                                            core/xpdo/xpdo.class.php on lines 1698..1721

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

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

                                                                                public function getComposites($className) {
                                                                                    $composites= array ();
                                                                                    if ($className= $this->loadClass($className)) {
                                                                                        if ($ancestry= $this->getAncestry($className)) {
                                                                                            for ($i= count($ancestry) - 1; $i >= 0; $i--) {
                                                                            Severity: Major
                                                                            Found in core/xpdo/xpdo.class.php and 3 other locations - About 7 hrs to fix
                                                                            core/xpdo/xpdo.class.php on lines 1395..1418
                                                                            core/xpdo/xpdo.class.php on lines 1465..1488
                                                                            core/xpdo/xpdo.class.php on lines 1667..1690

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

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

                                                                                public function getFieldAliases($className) {
                                                                                    $fieldAliases= array ();
                                                                                    if ($className= $this->loadClass($className)) {
                                                                                        if ($ancestry= $this->getAncestry($className)) {
                                                                                            for ($i= count($ancestry) - 1; $i >= 0; $i--) {
                                                                            Severity: Major
                                                                            Found in core/xpdo/xpdo.class.php and 3 other locations - About 7 hrs to fix
                                                                            core/xpdo/xpdo.class.php on lines 1395..1418
                                                                            core/xpdo/xpdo.class.php on lines 1667..1690
                                                                            core/xpdo/xpdo.class.php on lines 1698..1721

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

                                                                            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 (isset($this->map[$ancestor]['package']) && isset($this->packages[$this->map[$ancestor]['package']]['prefix'])) {
                                                                                                        $table= $this->packages[$this->map[$ancestor]['package']]['prefix'] . $table;
                                                                                                    } else {
                                                                                                        $table= $this->getOption(xPDO::OPT_TABLE_PREFIX, null, '') . $table;
                                                                                                    }
                                                                            Severity: Major
                                                                            Found in core/xpdo/xpdo.class.php and 1 other location - About 1 hr to fix
                                                                            core/xpdo/xpdo.class.php on lines 1267..1271

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

                                                                            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 (isset($this->map[$className]['package']) && isset($this->packages[$this->map[$className]['package']]['prefix'])) {
                                                                                                $table= $this->packages[$this->map[$className]['package']]['prefix'] . $table;
                                                                                            } else {
                                                                                                $table= $this->getOption(xPDO::OPT_TABLE_PREFIX, null, '') . $table;
                                                                                            }
                                                                            Severity: Major
                                                                            Found in core/xpdo/xpdo.class.php and 1 other location - About 1 hr to fix
                                                                            core/xpdo/xpdo.class.php on lines 1276..1280

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

                                                                            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

                                                                                        exit ('[' . date('Y-m-d H:i:s') . '] (' . $this->_getLogLevel($level) . $def . $file . $line . ') ' . $msg . "\n" . ($this->getDebug() === true ? '<pre>' . "\n" . print_r(debug_backtrace(), true) . "\n" . '</pre>' : ''));
                                                                            Severity: Major
                                                                            Found in core/xpdo/xpdo.class.php and 1 other location - About 1 hr to fix
                                                                            core/model/modx/modx.class.php on lines 2717..2717

                                                                            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

                                                                            There are no issues that match your filters.

                                                                            Category
                                                                            Status