modxcms/revolution

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

Summary

Maintainability
F
1 wk
Test Coverage

Function _installObject has a Cognitive Complexity of 138 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _installObject(& $transport, $options, $element, & $parentObject, $fkMeta) {
        $saved = false;
        $preExistingMode = xPDOTransport::PRESERVE_PREEXISTING;
        $upgrade = false;
        $exists = false;
Severity: Minor
Found in core/xpdo/transport/xpdoobjectvehicle.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 _uninstallObject has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
Open

    public function _uninstallObject(& $transport, $options, $element, & $parentObject, $fkMeta) {
        $uninstalled = false;
        $removed = false;
        $uninstallObject = true;
        $upgrade = false;
Severity: Minor
Found in core/xpdo/transport/xpdoobjectvehicle.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 _putRelated has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _putRelated(& $transport, $alias, & $object, & $payloadElement) {
        if (is_array($payloadElement)) {
            if (is_object($object) && $object instanceof xPDOObject) {
                if (isset ($this->payload['related_object_attributes'][$alias]) && is_array($this->payload['related_object_attributes'][$alias])) {
                    $payloadElement = array_merge($payloadElement, $this->payload['related_object_attributes'][$alias]);
Severity: Minor
Found in core/xpdo/transport/xpdoobjectvehicle.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

Function put has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

    public function put(& $transport, & $object, $attributes = array ()) {
        parent :: put($transport, $object, $attributes);
        if (is_object($object)) {
            if (!isset ($this->payload['package'])) {
                if ($object instanceof xPDOObject) {
Severity: Minor
Found in core/xpdo/transport/xpdoobjectvehicle.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

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

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

    Method _installObject has 131 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function _installObject(& $transport, $options, $element, & $parentObject, $fkMeta) {
            $saved = false;
            $preExistingMode = xPDOTransport::PRESERVE_PREEXISTING;
            $upgrade = false;
            $exists = false;
    Severity: Major
    Found in core/xpdo/transport/xpdoobjectvehicle.class.php - About 5 hrs to fix

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

          public function get(& $transport, $options = array (), $element = null) {
              $object = null;
              $element = parent :: get($transport, $options, $element);
              if (isset ($element['class']) && isset ($element['object'])) {
                  $vClass = $element['class'];
      Severity: Minor
      Found in core/xpdo/transport/xpdoobjectvehicle.class.php - About 4 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          public function _installRelated(& $transport, & $parent, $element, $options, $owner = '') {
              $installed = true;
              if (is_object($parent) && isset ($element[xPDOTransport::RELATED_OBJECTS]) && is_array($element[xPDOTransport::RELATED_OBJECTS])) {
                  foreach ($element[xPDOTransport::RELATED_OBJECTS] as $rAlias => $rVehicles) {
                      $rMeta = $parent->getFKDefinition($rAlias);
      Severity: Minor
      Found in core/xpdo/transport/xpdoobjectvehicle.class.php - About 3 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Method _uninstallObject has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function _uninstallObject(& $transport, $options, $element, & $parentObject, $fkMeta) {
              $uninstalled = false;
              $removed = false;
              $uninstallObject = true;
              $upgrade = false;
      Severity: Major
      Found in core/xpdo/transport/xpdoobjectvehicle.class.php - About 2 hrs to fix

        Method _putRelated has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function _putRelated(& $transport, $alias, & $object, & $payloadElement) {
                if (is_array($payloadElement)) {
                    if (is_object($object) && $object instanceof xPDOObject) {
                        if (isset ($this->payload['related_object_attributes'][$alias]) && is_array($this->payload['related_object_attributes'][$alias])) {
                            $payloadElement = array_merge($payloadElement, $this->payload['related_object_attributes'][$alias]);
        Severity: Minor
        Found in core/xpdo/transport/xpdoobjectvehicle.class.php - About 1 hr to fix

          Method put has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function put(& $transport, & $object, $attributes = array ()) {
                  parent :: put($transport, $object, $attributes);
                  if (is_object($object)) {
                      if (!isset ($this->payload['package'])) {
                          if ($object instanceof xPDOObject) {
          Severity: Minor
          Found in core/xpdo/transport/xpdoobjectvehicle.class.php - About 1 hr to fix

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

                public function get(& $transport, $options = array (), $element = null) {
                    $object = null;
                    $element = parent :: get($transport, $options, $element);
                    if (isset ($element['class']) && isset ($element['object'])) {
                        $vClass = $element['class'];
            Severity: Minor
            Found in core/xpdo/transport/xpdoobjectvehicle.class.php - About 1 hr to fix

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

                  public function _uninstallRelated(& $transport, & $parent, $element, $options) {
                      $uninstalled = true;
                      if (is_object($parent) && isset ($element[xPDOTransport::RELATED_OBJECTS]) && is_array($element[xPDOTransport::RELATED_OBJECTS])) {
                          $uninstalled = false;
                          foreach ($element[xPDOTransport::RELATED_OBJECTS] as $rAlias => $rVehicles) {
              Severity: Minor
              Found in core/xpdo/transport/xpdoobjectvehicle.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

              Avoid deeply nested control flow statements.
              Open

                                          if (!isset ($relatedObjects[$rAlias]))
                                              $relatedObjects[$rAlias] = array ();
              Severity: Major
              Found in core/xpdo/transport/xpdoobjectvehicle.class.php - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                                if (!isset ($relatedObjects[$rAlias]))
                                                    $relatedObjects[$rAlias] = array ();
                Severity: Major
                Found in core/xpdo/transport/xpdoobjectvehicle.class.php - About 45 mins to fix

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

                      protected function _installObject(& $transport, $options, $element, & $parentObject, $fkMeta) {
                  Severity: Minor
                  Found in core/xpdo/transport/xpdoobjectvehicle.class.php - About 35 mins to fix

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

                        public function _installRelated(& $transport, & $parent, $element, $options, $owner = '') {
                    Severity: Minor
                    Found in core/xpdo/transport/xpdoobjectvehicle.class.php - About 35 mins to fix

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

                          public function _uninstallObject(& $transport, $options, $element, & $parentObject, $fkMeta) {
                      Severity: Minor
                      Found in core/xpdo/transport/xpdoobjectvehicle.class.php - About 35 mins to fix

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

                                                foreach ($related as $rKey => $rObj) {
                                                    if (!isset ($relatedObjects[$rAlias]))
                                                        $relatedObjects[$rAlias] = array ();
                                                    $guid = md5(uniqid(rand(), true));
                                                    $relatedObjects[$rAlias][$guid] = array ();
                        Severity: Major
                        Found in core/xpdo/transport/xpdoobjectvehicle.class.php and 1 other location - About 6 hrs to fix
                        core/xpdo/transport/xpdoobjectvehicle.class.php on lines 482..493

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

                        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

                                            elseif (is_object($related)) {
                                                if (!isset ($relatedObjects[$rAlias]))
                                                    $relatedObjects[$rAlias] = array ();
                                                $guid = md5(uniqid(rand(), true));
                                                $relatedObjects[$rAlias][$guid] = array ();
                        Severity: Major
                        Found in core/xpdo/transport/xpdoobjectvehicle.class.php and 1 other location - About 6 hrs to fix
                        core/xpdo/transport/xpdoobjectvehicle.class.php on lines 469..480

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

                        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($pk) && is_array($nativeKey)) {
                                                $criteria = array_combine($pk, $nativeKey);
                                            } elseif (is_string($pk) && is_scalar($nativeKey)) {
                                                $criteria = array($pk => $nativeKey);
                                            } else {
                        Severity: Major
                        Found in core/xpdo/transport/xpdoobjectvehicle.class.php and 1 other location - About 1 hr to fix
                        core/xpdo/transport/xpdoobjectvehicle.class.php on lines 140..147

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

                        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 ($parentObject === null && !$this->resolve($transport, $object, $vOptions)) {
                                            $transport->xpdo->log(xPDO::LOG_LEVEL_ERROR, "Could not resolve vehicle for object of class {$vClass}; criteria: " . print_r($criteria, true));
                                            if ($transport->xpdo->getDebug() === true) $transport->xpdo->log(xPDO::LOG_LEVEL_DEBUG, 'Could not resolve vehicle: ' . print_r($vOptions, true));
                                        }
                        Severity: Major
                        Found in core/xpdo/transport/xpdoobjectvehicle.class.php and 1 other location - About 1 hr to fix
                        core/xpdo/transport/xpdoobjectvehicle.class.php on lines 350..353

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

                        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($pk) && is_array($nativeKey)) {
                                            $criteria = array_combine($pk, $nativeKey);
                                        } elseif (is_string($pk) && is_scalar($nativeKey)) {
                                            $criteria = array($pk => $nativeKey);
                                        } else {
                        Severity: Major
                        Found in core/xpdo/transport/xpdoobjectvehicle.class.php and 1 other location - About 1 hr to fix
                        core/xpdo/transport/xpdoobjectvehicle.class.php on lines 168..175

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

                        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 ($parentObject === null && !$this->resolve($transport, $object, $vOptions)) {
                                            $transport->xpdo->log(xPDO::LOG_LEVEL_ERROR, "Could not resolve vehicle for object of class {$vClass}; criteria: " . print_r($criteria, true));
                                            if ($transport->xpdo->getDebug() === true) $transport->xpdo->log(xPDO::LOG_LEVEL_DEBUG, 'Could not resolve vehicle: ' . print_r($vOptions, true));
                                        }
                        Severity: Major
                        Found in core/xpdo/transport/xpdoobjectvehicle.class.php and 1 other location - About 1 hr to fix
                        core/xpdo/transport/xpdoobjectvehicle.class.php on lines 228..231

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 119.

                        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

                                                elseif (is_object($related)) {
                                                    if (!isset ($relatedObjects[$rAlias]))
                                                        $relatedObjects[$rAlias] = array ();
                                                    $guid = md5(uniqid(rand(), true));
                                                    $relatedObjects[$rAlias][$guid] = array ();
                        Severity: Minor
                        Found in core/xpdo/transport/xpdoobjectvehicle.class.php and 1 other location - About 55 mins to fix
                        core/xpdo/transport/xpdoobjectvehicle.class.php on lines 414..420

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 99.

                        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

                                                    foreach ($related as $rKey => $rObj) {
                                                        if (!isset ($relatedObjects[$rAlias]))
                                                            $relatedObjects[$rAlias] = array ();
                                                        $guid = md5(uniqid(rand(), true));
                                                        $relatedObjects[$rAlias][$guid] = array ();
                        Severity: Minor
                        Found in core/xpdo/transport/xpdoobjectvehicle.class.php and 1 other location - About 55 mins to fix
                        core/xpdo/transport/xpdoobjectvehicle.class.php on lines 422..428

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

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

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

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

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

                        Refactorings

                        Further Reading

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

                                            if ($parentObject !== null && $fkMeta !== null) {
                                                if ($fkMeta['owner'] == 'foreign') {
                                                    if ($object->get($fkMeta['foreign']) !== $parentObject->get($fkMeta['local'])) {
                                                        $parentObject->set($fkMeta['local'], $object->get($fkMeta['foreign']));
                                                    }
                        Severity: Minor
                        Found in core/xpdo/transport/xpdoobjectvehicle.class.php and 1 other location - About 30 mins to fix
                        core/xpdo/transport/xpdoobjectvehicle.class.php on lines 116..122

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

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

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

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

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

                        Refactorings

                        Further Reading

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

                                    if ($parentObject !== null && $fkMeta !== null) {
                                        if ($fkMeta['owner'] == 'local') {
                                            if ($object->get($fkMeta['foreign']) !== $parentObject->get($fkMeta['local'])) {
                                                $object->set($fkMeta['foreign'], $parentObject->get($fkMeta['local']));
                                            }
                        Severity: Minor
                        Found in core/xpdo/transport/xpdoobjectvehicle.class.php and 1 other location - About 30 mins to fix
                        core/xpdo/transport/xpdoobjectvehicle.class.php on lines 216..222

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

                        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