modxcms/revolution

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

Summary

Maintainability
F
1 mo
Test Coverage

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

<?php
/*
 * Copyright 2010-2015 by MODX, LLC.
 *
 * This file is part of xPDO.
Severity: Major
Found in core/xpdo/om/xpdoobject.class.php - About 4 days to fix

    Function set has a Cognitive Complexity of 177 (exceeds 5 allowed). Consider refactoring.
    Open

        public function set($k, $v= null, $vType= '') {
            $set= false;
            $callback= '';
            $callable= !empty($vType) && is_callable($vType, false, $callback) ? true : false;
            if (!$callable && isset($this->_fieldMeta[$k]['callback'])) {
    Severity: Minor
    Found in core/xpdo/om/xpdoobject.class.php - About 3 days to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function save has a Cognitive Complexity of 161 (exceeds 5 allowed). Consider refactoring.
    Open

        public function save($cacheFlag= null) {
            if ($this->isLazy()) {
                $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, 'Attempt to save lazy object: ' . print_r($this->toArray('', true), 1));
                return false;
            }
    Severity: Minor
    Found in core/xpdo/om/xpdoobject.class.php - About 3 days to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function get has a Cognitive Complexity of 156 (exceeds 5 allowed). Consider refactoring.
    Open

        public function get($k, $format = null, $formatTemplate= null) {
            $value= null;
            if (is_array($k)) {
                $lazy = array_intersect($k, $this->_lazy);
                if ($lazy) {
    Severity: Minor
    Found in core/xpdo/om/xpdoobject.class.php - About 3 days to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function remove has a Cognitive Complexity of 100 (exceeds 5 allowed). Consider refactoring.
    Open

        public function remove(array $ancestors= array ()) {
            $result= false;
            $pk= $this->getPrimaryKey();
            if ($pk && $this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                $primaryKey = $pk;
    Severity: Minor
    Found in core/xpdo/om/xpdoobject.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 fromArray has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
    Open

        public function fromArray($fldarray, $keyPrefix= '', $setPrimaryKeys= false, $rawValues= false, $adhocValues= false) {
            if (is_array($fldarray)) {
                $pkSet= false;
                $generatedKey= false;
                foreach ($fldarray as $key => $val) {
    Severity: Minor
    Found in core/xpdo/om/xpdoobject.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 getGraph has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getGraph($graph = true, $criteria = null, $cacheFlag = true) {
            /* graph is true, get all relations to max depth */
            if ($graph === true) {
                $graph = $this->xpdo->getGraph($this->_class);
            }
    Severity: Minor
    Found in core/xpdo/om/xpdoobject.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 addOne has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
    Open

        public function addOne(& $obj, $alias= '') {
            $added= false;
            if (is_object($obj)) {
                if (empty ($alias)) {
                    if ($obj->_alias == $obj->_class) {
    Severity: Minor
    Found in core/xpdo/om/xpdoobject.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 _saveRelatedObjects has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function _saveRelatedObjects() {
            $saved= 0;
            if (!empty ($this->_relatedObjects)) {
                foreach ($this->_relatedObjects as $alias => $ro) {
                    $objects= array ();
    Severity: Minor
    Found in core/xpdo/om/xpdoobject.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

    xPDOObject has 55 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class xPDOObject {
        /**
         * A convenience reference to the xPDO object.
         * @var xPDO
         * @access public
    Severity: Major
    Found in core/xpdo/om/xpdoobject.class.php - About 7 hrs to fix

      Function load has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function load(xPDO & $xpdo, $className, $criteria, $cacheFlag= true) {
              $instance= null;
              $fromCache= false;
              if ($className= $xpdo->loadClass($className)) {
                  if (!is_object($criteria)) {
      Severity: Minor
      Found in core/xpdo/om/xpdoobject.class.php - About 7 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 save has 177 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function save($cacheFlag= null) {
              if ($this->isLazy()) {
                  $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, 'Attempt to save lazy object: ' . print_r($this->toArray('', true), 1));
                  return false;
              }
      Severity: Major
      Found in core/xpdo/om/xpdoobject.class.php - About 7 hrs to fix

        Function _loadRows has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function & _loadRows(& $xpdo, $className, $criteria) {
                $rows= null;
                if ($criteria->prepare()) {
                    if ($xpdo->getDebug() === true) $xpdo->log(xPDO::LOG_LEVEL_DEBUG, "Attempting to execute query using PDO statement object: " . print_r($criteria->sql, true) . print_r($criteria->bindings, true));
                    $tstart= microtime(true);
        Severity: Minor
        Found in core/xpdo/om/xpdoobject.class.php - About 6 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 addMany has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            public function addMany(& $obj, $alias= '') {
                $added= false;
                if (!is_array($obj)) {
                    if (is_object($obj)) {
                        if (empty ($alias)) {
        Severity: Minor
        Found in core/xpdo/om/xpdoobject.class.php - About 6 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 _getRelatedObjectsByFK has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function & _getRelatedObjectsByFK($alias, $criteria= null, $cacheFlag= true) {
                $collection= array ();
                if (isset($this->_relatedObjects[$alias]) && (is_object($this->_relatedObjects[$alias]) || (is_array($this->_relatedObjects[$alias]) && !empty ($this->_relatedObjects[$alias])))) {
                    $collection= & $this->_relatedObjects[$alias];
                } else {
        Severity: Minor
        Found in core/xpdo/om/xpdoobject.class.php - About 6 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 set has 149 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function set($k, $v= null, $vType= '') {
                $set= false;
                $callback= '';
                $callable= !empty($vType) && is_callable($vType, false, $callback) ? true : false;
                if (!$callable && isset($this->_fieldMeta[$k]['callback'])) {
        Severity: Major
        Found in core/xpdo/om/xpdoobject.class.php - About 5 hrs to fix

          Function toArray has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
          Open

              public function toArray($keyPrefix= '', $rawValues= false, $excludeLazy= false, $includeRelated= false) {
                  $objArray= null;
                  if (is_array($this->_fields)) {
                      $keys= array_keys($this->_fields);
                      if (!$excludeLazy && $this->isLazy()) {
          Severity: Minor
          Found in core/xpdo/om/xpdoobject.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 getSelectColumns has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function getSelectColumns(xPDO & $xpdo, $className, $tableAlias= '', $columnPrefix= '', $columns= array (), $exclude= false) {
                  $columnarray= array ();
                  $aColumns= $xpdo->getFields($className);
                  if ($aColumns) {
                      if (!empty ($tableAlias)) {
          Severity: Minor
          Found in core/xpdo/om/xpdoobject.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

          Method get has 135 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function get($k, $format = null, $formatTemplate= null) {
                  $value= null;
                  if (is_array($k)) {
                      $lazy = array_intersect($k, $this->_lazy);
                      if ($lazy) {
          Severity: Major
          Found in core/xpdo/om/xpdoobject.class.php - About 5 hrs to fix

            Function _saveRelatedObject has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function _saveRelatedObject(& $obj, $fkMeta) {
                    $saved= false;
                    $local= $fkMeta['local'];
                    $foreign= $fkMeta['foreign'];
                    $cardinality= $fkMeta['cardinality'];
            Severity: Minor
            Found in core/xpdo/om/xpdoobject.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

            Method remove has 97 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function remove(array $ancestors= array ()) {
                    $result= false;
                    $pk= $this->getPrimaryKey();
                    if ($pk && $this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                        $primaryKey = $pk;
            Severity: Major
            Found in core/xpdo/om/xpdoobject.class.php - About 3 hrs to fix

              Function getIterator has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getIterator($alias, $criteria= null, $cacheFlag= true) {
                      $iterator = false;
                      $fkMeta= $this->getFKDefinition($alias);
                      if ($fkMeta) {
                          $fkCriteria = isset($fkMeta['criteria']) && isset($fkMeta['criteria']['foreign']) ? $fkMeta['criteria']['foreign'] : null;
              Severity: Minor
              Found in core/xpdo/om/xpdoobject.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 _loadInstance has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function _loadInstance(& $xpdo, $className, $criteria, $row) {
                      $rowPrefix= '';
                      if (is_object($criteria) && $criteria instanceof xPDOQuery) {
                          $alias = $criteria->getAlias();
                          $actualClass = $criteria->getClass();
              Severity: Minor
              Found in core/xpdo/om/xpdoobject.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 getPrimaryKey has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getPrimaryKey($validateCompound= true) {
                      $value= null;
                      if ($pk= $this->getPK()) {
                          if (is_array($pk)) {
                              foreach ($pk as $k) {
              Severity: Minor
              Found in core/xpdo/om/xpdoobject.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 _setRaw has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function _setRaw($key, $val) {
                      $set = false;
                      if ($val === null) {
                          $this->_fields[$key] = null;
                          $set = true;
              Severity: Minor
              Found in core/xpdo/om/xpdoobject.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 getFKClass has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getFKClass($k) {
                      $fkclass= null;
                      $k = $this->getField($k, true);
                      if (is_string($k)) {
                          if (!empty ($this->_aggregates)) {
              Severity: Minor
              Found in core/xpdo/om/xpdoobject.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 loadCollection has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function loadCollection(xPDO & $xpdo, $className, $criteria= null, $cacheFlag= true) {
                      $objCollection= array ();
                      $fromCache = false;
                      if (!$className= $xpdo->loadClass($className)) return $objCollection;
                      $rows= false;
              Severity: Minor
              Found in core/xpdo/om/xpdoobject.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 _setRaw has 60 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function _setRaw($key, $val) {
                      $set = false;
                      if ($val === null) {
                          $this->_fields[$key] = null;
                          $set = true;
              Severity: Major
              Found in core/xpdo/om/xpdoobject.class.php - About 2 hrs to fix

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

                    public static function _loadCollectionInstance(xPDO & $xpdo, array & $objCollection, $className, $criteria, $row, $fromCache, $cacheFlag=true) {
                        $loaded = false;
                        if ($obj= xPDOObject :: _loadInstance($xpdo, $className, $criteria, $row)) {
                            if (($cacheKey= $obj->getPrimaryKey()) && !$obj->isLazy()) {
                                if (is_array($cacheKey)) {
                Severity: Minor
                Found in core/xpdo/om/xpdoobject.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 getGraph has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getGraph($graph = true, $criteria = null, $cacheFlag = true) {
                        /* graph is true, get all relations to max depth */
                        if ($graph === true) {
                            $graph = $this->xpdo->getGraph($this->_class);
                        }
                Severity: Major
                Found in core/xpdo/om/xpdoobject.class.php - About 2 hrs to fix

                  Method _loadRows has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function & _loadRows(& $xpdo, $className, $criteria) {
                          $rows= null;
                          if ($criteria->prepare()) {
                              if ($xpdo->getDebug() === true) $xpdo->log(xPDO::LOG_LEVEL_DEBUG, "Attempting to execute query using PDO statement object: " . print_r($criteria->sql, true) . print_r($criteria->bindings, true));
                              $tstart= microtime(true);
                  Severity: Major
                  Found in core/xpdo/om/xpdoobject.class.php - About 2 hrs to fix

                    Method _loadInstance has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function _loadInstance(& $xpdo, $className, $criteria, $row) {
                            $rowPrefix= '';
                            if (is_object($criteria) && $criteria instanceof xPDOQuery) {
                                $alias = $criteria->getAlias();
                                $actualClass = $criteria->getClass();
                    Severity: Major
                    Found in core/xpdo/om/xpdoobject.class.php - About 2 hrs to fix

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

                          public static function loadCollectionGraph(xPDO & $xpdo, $className, $graph, $criteria, $cacheFlag) {
                              $objCollection = array();
                              if ($query= $xpdo->newQuery($className, $criteria, $cacheFlag)) {
                                  $query = $xpdo->addDerivativeCriteria($className, $query);
                                  $query->bindGraph($graph);
                      Severity: Minor
                      Found in core/xpdo/om/xpdoobject.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 addOne has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function addOne(& $obj, $alias= '') {
                              $added= false;
                              if (is_object($obj)) {
                                  if (empty ($alias)) {
                                      if ($obj->_alias == $obj->_class) {
                      Severity: Major
                      Found in core/xpdo/om/xpdoobject.class.php - About 2 hrs to fix

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

                            public function fromArray($fldarray, $keyPrefix= '', $setPrimaryKeys= false, $rawValues= false, $adhocValues= false) {
                                if (is_array($fldarray)) {
                                    $pkSet= false;
                                    $generatedKey= false;
                                    foreach ($fldarray as $key => $val) {
                        Severity: Minor
                        Found in core/xpdo/om/xpdoobject.class.php - About 1 hr to fix

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

                              public function & getOne($alias, $criteria= null, $cacheFlag= true) {
                                  $object= null;
                                  if ($fkdef= $this->getFKDefinition($alias)) {
                                      $k= $fkdef['local'];
                                      $fk= $fkdef['foreign'];
                          Severity: Minor
                          Found in core/xpdo/om/xpdoobject.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 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function __construct(xPDO & $xpdo) {
                                  $this->xpdo= & $xpdo;
                                  $this->container= $xpdo->config['dbname'];
                                  $this->_class= get_class($this);
                                  $pos= strrpos($this->_class, '_');
                          Severity: Minor
                          Found in core/xpdo/om/xpdoobject.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 load has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function load(xPDO & $xpdo, $className, $criteria, $cacheFlag= true) {
                                  $instance= null;
                                  $fromCache= false;
                                  if ($className= $xpdo->loadClass($className)) {
                                      if (!is_object($criteria)) {
                          Severity: Minor
                          Found in core/xpdo/om/xpdoobject.class.php - About 1 hr to fix

                            Method getSelectColumns has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public static function getSelectColumns(xPDO & $xpdo, $className, $tableAlias= '', $columnPrefix= '', $columns= array (), $exclude= false) {
                                    $columnarray= array ();
                                    $aColumns= $xpdo->getFields($className);
                                    if ($aColumns) {
                                        if (!empty ($tableAlias)) {
                            Severity: Minor
                            Found in core/xpdo/om/xpdoobject.class.php - About 1 hr to fix

                              Method toArray has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function toArray($keyPrefix= '', $rawValues= false, $excludeLazy= false, $includeRelated= false) {
                                      $objArray= null;
                                      if (is_array($this->_fields)) {
                                          $keys= array_keys($this->_fields);
                                          if (!$excludeLazy && $this->isLazy()) {
                              Severity: Minor
                              Found in core/xpdo/om/xpdoobject.class.php - About 1 hr to fix

                                Method _getRelatedObjectsByFK has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected function & _getRelatedObjectsByFK($alias, $criteria= null, $cacheFlag= true) {
                                        $collection= array ();
                                        if (isset($this->_relatedObjects[$alias]) && (is_object($this->_relatedObjects[$alias]) || (is_array($this->_relatedObjects[$alias]) && !empty ($this->_relatedObjects[$alias])))) {
                                            $collection= & $this->_relatedObjects[$alias];
                                        } else {
                                Severity: Minor
                                Found in core/xpdo/om/xpdoobject.class.php - About 1 hr to fix

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

                                      protected function _getAliases($class, $limit = 0) {
                                          $aliases = array();
                                          $limit = intval($limit);
                                          $array = array('aggregates' => $this->_aggregates, 'composites' => $this->_composites);
                                          foreach ($array as $relType => $relations) {
                                  Severity: Minor
                                  Found in core/xpdo/om/xpdoobject.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 addMany has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function addMany(& $obj, $alias= '') {
                                          $added= false;
                                          if (!is_array($obj)) {
                                              if (is_object($obj)) {
                                                  if (empty ($alias)) {
                                  Severity: Minor
                                  Found in core/xpdo/om/xpdoobject.class.php - About 1 hr to fix

                                    Method loadCollection has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public static function loadCollection(xPDO & $xpdo, $className, $criteria= null, $cacheFlag= true) {
                                            $objCollection= array ();
                                            $fromCache = false;
                                            if (!$className= $xpdo->loadClass($className)) return $objCollection;
                                            $rows= false;
                                    Severity: Minor
                                    Found in core/xpdo/om/xpdoobject.class.php - About 1 hr to fix

                                      Method _saveRelatedObject has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          protected function _saveRelatedObject(& $obj, $fkMeta) {
                                              $saved= false;
                                              $local= $fkMeta['local'];
                                              $foreign= $fkMeta['foreign'];
                                              $cardinality= $fkMeta['cardinality'];
                                      Severity: Minor
                                      Found in core/xpdo/om/xpdoobject.class.php - About 1 hr to fix

                                        Method _saveRelatedObjects has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            protected function _saveRelatedObjects() {
                                                $saved= 0;
                                                if (!empty ($this->_relatedObjects)) {
                                                    foreach ($this->_relatedObjects as $alias => $ro) {
                                                        $objects= array ();
                                        Severity: Minor
                                        Found in core/xpdo/om/xpdoobject.class.php - About 1 hr to fix

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

                                              public function __construct(xPDO & $xpdo) {
                                                  $this->xpdo= & $xpdo;
                                                  $this->container= $xpdo->config['dbname'];
                                                  $this->_class= get_class($this);
                                                  $pos= strrpos($this->_class, '_');
                                          Severity: Minor
                                          Found in core/xpdo/om/xpdoobject.class.php - About 1 hr to fix

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

                                                public function addFieldAlias($field, $alias) {
                                                    $added = false;
                                                    if (array_key_exists($field, $this->_fields)) {
                                                        if (!array_key_exists($alias, $this->_fields)) {
                                                            $this->_fields[$alias] =& $this->_fields[$field];
                                            Severity: Minor
                                            Found in core/xpdo/om/xpdoobject.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 loadCollectionGraph has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                public static function loadCollectionGraph(xPDO & $xpdo, $className, $graph, $criteria, $cacheFlag) {
                                                    $objCollection = array();
                                                    if ($query= $xpdo->newQuery($className, $criteria, $cacheFlag)) {
                                                        $query = $xpdo->addDerivativeCriteria($className, $query);
                                                        $query->bindGraph($graph);
                                            Severity: Minor
                                            Found in core/xpdo/om/xpdoobject.class.php - About 1 hr to fix

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

                                                  public function getPrimaryKey($validateCompound= true) {
                                                      $value= null;
                                                      if ($pk= $this->getPK()) {
                                                          if (is_array($pk)) {
                                                              foreach ($pk as $k) {
                                              Severity: Minor
                                              Found in core/xpdo/om/xpdoobject.class.php - About 1 hr to fix

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

                                                    public function __get($name) {
                                                        if ($this->getOption(xPDO::OPT_HYDRATE_FIELDS) && array_key_exists($name, $this->_fields)) {
                                                            return $this->_fields[$name];
                                                        } elseif ($this->getOption(xPDO::OPT_HYDRATE_RELATED_OBJECTS)) {
                                                            if (array_key_exists($name, $this->_composites)) {
                                                Severity: Minor
                                                Found in core/xpdo/om/xpdoobject.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 __set has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                                Open

                                                    public function __set($name, $value) {
                                                        if ($this->getOption(xPDO::OPT_HYDRATE_FIELDS) && array_key_exists($name, $this->_fields)) {
                                                            return $this->_setRaw($name, $value);
                                                        } elseif ($this->getOption(xPDO::OPT_HYDRATE_RELATED_OBJECTS)) {
                                                            if (array_key_exists($name, $this->_composites)) {
                                                Severity: Minor
                                                Found in core/xpdo/om/xpdoobject.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 getIterator has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                    public function getIterator($alias, $criteria= null, $cacheFlag= true) {
                                                        $iterator = false;
                                                        $fkMeta= $this->getFKDefinition($alias);
                                                        if ($fkMeta) {
                                                            $fkCriteria = isset($fkMeta['criteria']) && isset($fkMeta['criteria']['foreign']) ? $fkMeta['criteria']['foreign'] : null;
                                                Severity: Minor
                                                Found in core/xpdo/om/xpdoobject.class.php - About 1 hr to fix

                                                  Consider simplifying this complex logical expression.
                                                  Open

                                                                  if (in_array($this->_fieldMeta[$_k]['phptype'], array ('datetime', 'timestamp')) && !empty($this->_fieldMeta[$_k]['attributes']) && $this->_fieldMeta[$_k]['attributes'] == 'ON UPDATE CURRENT_TIMESTAMP') {
                                                                      $this->_fields[$_k]= date('Y-m-d H:i:s');
                                                                      continue;
                                                                  }
                                                                  elseif ($fieldValue === null || $fieldValue === 'NULL') {
                                                  Severity: Major
                                                  Found in core/xpdo/om/xpdoobject.class.php - About 1 hr to fix

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

                                                        public function setDirty($key= '') {
                                                            if (empty($key)) {
                                                                foreach (array_keys($this->_fieldMeta) as $fIdx => $fieldKey) {
                                                                    $this->setDirty($fieldKey);
                                                                }
                                                    Severity: Minor
                                                    Found in core/xpdo/om/xpdoobject.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 _loadCollectionInstance has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                    Open

                                                        public static function _loadCollectionInstance(xPDO & $xpdo, array & $objCollection, $className, $criteria, $row, $fromCache, $cacheFlag=true) {
                                                    Severity: Major
                                                    Found in core/xpdo/om/xpdoobject.class.php - About 50 mins to fix

                                                      Avoid deeply nested control flow statements.
                                                      Open

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

                                                        Avoid deeply nested control flow statements.
                                                        Open

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

                                                          Avoid deeply nested control flow statements.
                                                          Open

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

                                                            Avoid deeply nested control flow statements.
                                                            Open

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

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

                                                                  public function getValidator() {
                                                                      if (!is_object($this->_validator)) {
                                                                          $validatorClass = $this->xpdo->loadClass('validation.xPDOValidator', XPDO_CORE_PATH, true, true);
                                                                          if ($derivedClass = $this->getOption(xPDO::OPT_VALIDATOR_CLASS, null, '')) {
                                                                              if ($derivedClass = $this->xpdo->loadClass($derivedClass, '', false, true)) {
                                                              Severity: Minor
                                                              Found in core/xpdo/om/xpdoobject.class.php - About 45 mins to fix

                                                              Cognitive Complexity

                                                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                              A method's cognitive complexity is based on a few simple rules:

                                                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                              • Code is considered more complex for each "break in the linear flow of the code"
                                                              • Code is considered more complex when "flow breaking structures are nested"

                                                              Further reading

                                                              Avoid deeply nested control flow statements.
                                                              Open

                                                                                          if (is_string($value)) {
                                                                                              $value= unserialize($value);
                                                                                          }
                                                              Severity: Major
                                                              Found in core/xpdo/om/xpdoobject.class.php - About 45 mins to fix

                                                                Avoid deeply nested control flow statements.
                                                                Open

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

                                                                  Avoid deeply nested control flow statements.
                                                                  Open

                                                                                                  if (in_array($childPK, $ancestors[$composite['class']])) {
                                                                                                      continue;
                                                                                                  }
                                                                  Severity: Major
                                                                  Found in core/xpdo/om/xpdoobject.class.php - About 45 mins to fix

                                                                    Avoid deeply nested control flow statements.
                                                                    Open

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

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

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

                                                                        Avoid deeply nested control flow statements.
                                                                        Open

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

                                                                          Avoid deeply nested control flow statements.
                                                                          Open

                                                                                                  if ($pkGenerated) {
                                                                                                      $this->_fields[$this->getPK()]= $this->xpdo->lastInsertId();
                                                                                                  }
                                                                          Severity: Major
                                                                          Found in core/xpdo/om/xpdoobject.class.php - About 45 mins to fix

                                                                            Avoid deeply nested control flow statements.
                                                                            Open

                                                                                                            if (is_array($childPK)) {
                                                                                                                $childPK = implode('|', $childPK);
                                                                                                            }
                                                                            Severity: Major
                                                                            Found in core/xpdo/om/xpdoobject.class.php - About 45 mins to fix

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

                                                                                  public function fromArray($fldarray, $keyPrefix= '', $setPrimaryKeys= false, $rawValues= false, $adhocValues= false) {
                                                                              Severity: Minor
                                                                              Found in core/xpdo/om/xpdoobject.class.php - About 35 mins to fix

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

                                                                                    public function fromJSON($jsonSource, $keyPrefix= '', $setPrimaryKeys= false, $rawValues= false, $adhocValues= false) {
                                                                                Severity: Minor
                                                                                Found in core/xpdo/om/xpdoobject.class.php - About 35 mins to fix

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

                                                                                      public function addValidationRule($field, $name, $type, $rule, array $parameters= array()) {
                                                                                  Severity: Minor
                                                                                  Found in core/xpdo/om/xpdoobject.class.php - About 35 mins to fix

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

                                                                                        public static function loadCollectionGraph(xPDO & $xpdo, $className, $graph, $criteria, $cacheFlag) {
                                                                                    Severity: Minor
                                                                                    Found in core/xpdo/om/xpdoobject.class.php - About 35 mins to fix

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

                                                                                          public function removeValidationRules($field = null, array $rules = array()) {
                                                                                              if (!$this->_validationLoaded) $this->_loadValidation();
                                                                                              if (empty($rules) && is_string($field)) {
                                                                                                  unset($this->_validationRules[$this->getField($field)]);
                                                                                              } elseif (empty($rules) && is_null($field)) {
                                                                                      Severity: Minor
                                                                                      Found in core/xpdo/om/xpdoobject.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 addValidationRule has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                                      Open

                                                                                          public function addValidationRule($field, $name, $type, $rule, array $parameters= array()) {
                                                                                              $field = $this->getField($field);
                                                                                              if (is_string($field)) {
                                                                                                  if (!$this->_validationLoaded) $this->_loadValidation();
                                                                                                  if (!isset($this->_validationRules[$field])) $this->_validationRules[$field]= array();
                                                                                      Severity: Minor
                                                                                      Found in core/xpdo/om/xpdoobject.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 _loadValidation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                                      Open

                                                                                          public function _loadValidation($reload= false) {
                                                                                              if (!$this->_validationLoaded || $reload == true) {
                                                                                                  $validation= $this->xpdo->getValidationRules($this->_class);
                                                                                                  $this->_validationLoaded= true;
                                                                                                  foreach ($validation as $column => $rules) {
                                                                                      Severity: Minor
                                                                                      Found in core/xpdo/om/xpdoobject.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

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

                                                                                                  return $this->getOne($name);
                                                                                      Severity: Major
                                                                                      Found in core/xpdo/om/xpdoobject.class.php - About 30 mins to fix

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

                                                                                                    return $this->addOne($value, $name);
                                                                                        Severity: Major
                                                                                        Found in core/xpdo/om/xpdoobject.class.php - About 30 mins to fix

                                                                                          Function validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                          Open

                                                                                              public function validate(array $options = array()) {
                                                                                                  $validated= false;
                                                                                                  if ($validator= $this->getValidator()) {
                                                                                                      $validated= $this->_validator->validate($options);
                                                                                                      if ($this->xpdo->getDebug() === true) {
                                                                                          Severity: Minor
                                                                                          Found in core/xpdo/om/xpdoobject.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

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

                                                                                                          if (!is_array($row)) {
                                                                                                              if ($xpdo->getDebug() === true) $xpdo->log(xPDO::LOG_LEVEL_DEBUG, "Fetched empty result set from statement: " . print_r($criteria->sql, true) . " with bindings: " . print_r($criteria->bindings, true));
                                                                                                          } else {
                                                                                                              $instance= xPDOObject :: _loadInstance($xpdo, $className, $criteria, $row);
                                                                                                              if (is_object($instance)) {
                                                                                          Severity: Major
                                                                                          Found in core/xpdo/om/xpdoobject.class.php and 1 other location - About 1 day to fix
                                                                                          core/model/modx/modaccessibleobject.class.php on lines 104..118

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

                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                          Refactorings

                                                                                          Further Reading

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

                                                                                              public static function _loadCollectionInstance(xPDO & $xpdo, array & $objCollection, $className, $criteria, $row, $fromCache, $cacheFlag=true) {
                                                                                                  $loaded = false;
                                                                                                  if ($obj= xPDOObject :: _loadInstance($xpdo, $className, $criteria, $row)) {
                                                                                                      if (($cacheKey= $obj->getPrimaryKey()) && !$obj->isLazy()) {
                                                                                                          if (is_array($cacheKey)) {
                                                                                          Severity: Major
                                                                                          Found in core/xpdo/om/xpdoobject.class.php and 1 other location - About 1 day to fix
                                                                                          core/model/modx/modaccessibleobject.class.php on lines 52..77

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

                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                          Refactorings

                                                                                          Further Reading

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

                                                                                                          if ($criteria === null) {
                                                                                                              $criteria= array($fkMeta['foreign'] => $this->get($fkMeta['local']));
                                                                                                              if ($fkCriteria !== null) {
                                                                                                                  $criteria= array($fkCriteria, $criteria);
                                                                                                              }
                                                                                          Severity: Major
                                                                                          Found in core/xpdo/om/xpdoobject.class.php and 2 other locations - About 6 hrs to fix
                                                                                          core/xpdo/om/xpdoobject.class.php on lines 1168..1187
                                                                                          core/xpdo/om/xpdoobject.class.php on lines 1918..1937

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

                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                          Refactorings

                                                                                          Further Reading

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

                                                                                                      if ($criteria === null) {
                                                                                                          $criteria= array($fkMeta['foreign'] => $this->get($fkMeta['local']));
                                                                                                          if ($fkCriteria !== null) {
                                                                                                              $criteria = array($fkCriteria, $criteria);
                                                                                                          }
                                                                                          Severity: Major
                                                                                          Found in core/xpdo/om/xpdoobject.class.php and 2 other locations - About 6 hrs to fix
                                                                                          core/xpdo/om/xpdoobject.class.php on lines 1918..1937
                                                                                          core/xpdo/om/xpdoobject.class.php on lines 2244..2263

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

                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                          Refactorings

                                                                                          Further Reading

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

                                                                                                              if ($criteria === null) {
                                                                                                                  $query= array($fkMeta['foreign'] => $this->get($fkMeta['local']));
                                                                                                                  if ($fkCriteria !== null) {
                                                                                                                      $query= array($fkCriteria, $query);
                                                                                                                  }
                                                                                          Severity: Major
                                                                                          Found in core/xpdo/om/xpdoobject.class.php and 2 other locations - About 6 hrs to fix
                                                                                          core/xpdo/om/xpdoobject.class.php on lines 1168..1187
                                                                                          core/xpdo/om/xpdoobject.class.php on lines 2244..2263

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

                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                          Refactorings

                                                                                          Further Reading

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

                                                                                                  if (is_array ($rows)) {
                                                                                                      foreach ($rows as $row) {
                                                                                                          xPDOObject :: _loadCollectionInstance($xpdo, $objCollection, $className, $criteria, $row, $fromCache, $cacheFlag);
                                                                                                      }
                                                                                                  } elseif (is_object($rows)) {
                                                                                          Severity: Major
                                                                                          Found in core/xpdo/om/xpdoobject.class.php and 1 other location - About 4 hrs to fix
                                                                                          core/model/modx/modaccessibleobject.class.php on lines 150..161

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

                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                          Refactorings

                                                                                          Further Reading

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

                                                                                                              } else {
                                                                                                                  $tstart= microtime(true);
                                                                                                                  if (!$criteria->stmt->execute()) {
                                                                                                                      $xpdo->queryTime += microtime(true) - $tstart;
                                                                                                                      $xpdo->executedQueries++;
                                                                                          Severity: Major
                                                                                          Found in core/xpdo/om/xpdoobject.class.php and 1 other location - About 3 hrs to fix
                                                                                          core/xpdo/om/xpdoobject.class.php on lines 242..254

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

                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                          Refactorings

                                                                                          Further Reading

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

                                                                                                              if ($xpdo->getManager() && $xpdo->manager->createObjectContainer($className)) {
                                                                                                                  $tstart= microtime(true);
                                                                                                                  if (!$criteria->stmt->execute()) {
                                                                                                                      $xpdo->queryTime += microtime(true) - $tstart;
                                                                                                                      $xpdo->executedQueries++;
                                                                                          Severity: Major
                                                                                          Found in core/xpdo/om/xpdoobject.class.php and 1 other location - About 3 hrs to fix
                                                                                          core/xpdo/om/xpdoobject.class.php on lines 268..278

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

                                                                                          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

                                                                                              protected function _getDataType($key) {
                                                                                                  $type= 'text';
                                                                                                  $actualKey = $this->getField($key, true);
                                                                                                  if ($actualKey !== false && isset($this->_fieldMeta[$actualKey]['dbtype'])) {
                                                                                                      $type= strtolower($this->_fieldMeta[$actualKey]['dbtype']);
                                                                                          Severity: Major
                                                                                          Found in core/xpdo/om/xpdoobject.class.php and 1 other location - About 2 hrs to fix
                                                                                          core/xpdo/om/xpdoobject.class.php on lines 2431..2440

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

                                                                                          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

                                                                                              protected function _getPHPType($key) {
                                                                                                  $type= 'string';
                                                                                                  $actualKey = $this->getField($key, true);
                                                                                                  if ($actualKey !== false && isset($this->_fieldMeta[$actualKey]['phptype'])) {
                                                                                                      $type= strtolower($this->_fieldMeta[$actualKey]['phptype']);
                                                                                          Severity: Major
                                                                                          Found in core/xpdo/om/xpdoobject.class.php and 1 other location - About 2 hrs to fix
                                                                                          core/xpdo/om/xpdoobject.class.php on lines 2413..2422

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

                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                          Refactorings

                                                                                          Further Reading

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

                                                                                                                      if (is_string($format) && !empty ($format)) {
                                                                                                                          if (strpos($format, 're:') === 0) {
                                                                                                                              if (!empty ($formatTemplate) && is_string($formatTemplate)) {
                                                                                                                                  $value= preg_replace(substr($format, 3), $formatTemplate, $value);
                                                                                                                              }
                                                                                          Severity: Major
                                                                                          Found in core/xpdo/om/xpdoobject.class.php and 2 other locations - About 1 hr to fix
                                                                                          core/xpdo/om/xpdoobject.class.php on lines 986..994
                                                                                          core/xpdo/om/xpdoobject.class.php on lines 998..1006

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

                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                          Refactorings

                                                                                          Further Reading

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

                                                                                                                      if (is_string($format) && !empty ($format)) {
                                                                                                                          if (strpos($format, 're:') === 0) {
                                                                                                                              if (!empty ($formatTemplate) && is_string($formatTemplate)) {
                                                                                                                                  $value= preg_replace(substr($format, 3), $formatTemplate, $value);
                                                                                                                              }
                                                                                          Severity: Major
                                                                                          Found in core/xpdo/om/xpdoobject.class.php and 2 other locations - About 1 hr to fix
                                                                                          core/xpdo/om/xpdoobject.class.php on lines 986..994
                                                                                          core/xpdo/om/xpdoobject.class.php on lines 1070..1078

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

                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                          Refactorings

                                                                                          Further Reading

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

                                                                                                                      if (is_string($format) && !empty ($format)) {
                                                                                                                          if (strpos($format, 're:') === 0) {
                                                                                                                              if (!empty ($formatTemplate) && is_string($formatTemplate)) {
                                                                                                                                  $value= preg_replace(substr($format, 3), $formatTemplate, $value);
                                                                                                                              }
                                                                                          Severity: Major
                                                                                          Found in core/xpdo/om/xpdoobject.class.php and 2 other locations - About 1 hr to fix
                                                                                          core/xpdo/om/xpdoobject.class.php on lines 998..1006
                                                                                          core/xpdo/om/xpdoobject.class.php on lines 1070..1078

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

                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                          Refactorings

                                                                                          Further Reading

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

                                                                                                                              if (preg_match('/int/i', $dbtype)) {
                                                                                                                                  if (strtolower($vType) == 'integer' || is_int($v) || $v == '0') {
                                                                                                                                      $ts= (integer) $v;
                                                                                                                                  } else {
                                                                                                                                      $ts= strtotime($v);
                                                                                          Severity: Major
                                                                                          Found in core/xpdo/om/xpdoobject.class.php and 1 other location - About 1 hr to fix
                                                                                          core/xpdo/om/xpdoobject.class.php on lines 848..875

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

                                                                                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                          Refactorings

                                                                                          Further Reading

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

                                                                                                                              if (preg_match('/int/i', $dbtype)) {
                                                                                                                                  if (strtolower($vType) == 'integer' || is_int($v) || $v == '0') {
                                                                                                                                      $ts= (integer) $v;
                                                                                                                                  } else {
                                                                                                                                      $ts= strtotime($v);
                                                                                          Severity: Major
                                                                                          Found in core/xpdo/om/xpdoobject.class.php and 1 other location - About 1 hr to fix
                                                                                          core/xpdo/om/xpdoobject.class.php on lines 819..845

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

                                                                                          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