modxcms/revolution

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

Summary

Maintainability
F
1 wk
Test Coverage

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

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

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

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

    Function getColumnDef has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function getColumnDef($class, $name, $meta, array $options = array()) {
            $pk= $this->xpdo->getPK($class);
            $pktype= $this->xpdo->getPKType($class);
            $dbtype= strtoupper($meta['dbtype']);
            $precision= (isset ($meta['precision']) && !preg_match('/ENUM/i', $dbtype) && !in_array($this->xpdo->driver->getPHPType($dbtype), array('integer', 'bit', 'date', 'datetime', 'time'))) ? '(' . $meta['precision'] . ')' : '';
    Severity: Minor
    Found in core/xpdo/om/sqlsrv/xpdomanager.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 createSourceContainer has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

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

    Cognitive Complexity

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

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

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

    Further reading

    Function addIndex has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

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

    Cognitive Complexity

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

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

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

    Further reading

    Function removeSourceContainer has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function removeSourceContainer($dsnArray = null, $username= null, $password= null) {
            $removed= false;
            if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                if ($dsnArray === null) $dsnArray = xPDO::parseDSN($this->xpdo->getOption('dsn'));
                if ($username === null) $username = $this->xpdo->getOption('username', null, '');
    Severity: Minor
    Found in core/xpdo/om/sqlsrv/xpdomanager.class.php - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function addField has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

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

    Cognitive Complexity

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

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

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

    Further reading

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

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

    Cognitive Complexity

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

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

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

    Further reading

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

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

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

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

      Cognitive Complexity

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

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

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

      Further reading

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

          protected function getColumnDef($class, $name, $meta, array $options = array()) {
              $pk= $this->xpdo->getPK($class);
              $pktype= $this->xpdo->getPKType($class);
              $dbtype= strtoupper($meta['dbtype']);
              $precision= (isset ($meta['precision']) && !preg_match('/ENUM/i', $dbtype) && !in_array($this->xpdo->driver->getPHPType($dbtype), array('integer', 'bit', 'date', 'datetime', 'time'))) ? '(' . $meta['precision'] . ')' : '';
      Severity: Minor
      Found in core/xpdo/om/sqlsrv/xpdomanager.class.php - About 1 hr to fix

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

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

        Cognitive Complexity

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

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

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

        Further reading

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

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

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

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

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

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

            Cognitive Complexity

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

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

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

            Further reading

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

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

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

                  public function removeObjectContainer($className) {
                      $removed= false;
                      if ($this->xpdo->getConnection(array(xPDO::OPT_CONN_MUTABLE => true))) {
                          $instance= $this->xpdo->newObject($className);
                          if ($instance) {
              Severity: Minor
              Found in core/xpdo/om/sqlsrv/xpdomanager.class.php - About 55 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

              Consider simplifying this complex logical expression.
              Open

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

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

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

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

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

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

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

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

                Refactorings

                Further Reading

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

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

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

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

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

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

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

                Refactorings

                Further Reading

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

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

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 268.

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

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

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

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

                Refactorings

                Further Reading

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

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

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 183.

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

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

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

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

                Refactorings

                Further Reading

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

                                if ($created === true && !empty($createIndices)) {
                                    foreach ($createIndices as $createIndexKey => $createIndex) {
                                        $indexCreated = $this->xpdo->exec($createIndex);
                                        if ($indexCreated === false && $this->xpdo->errorCode() !== '' && $this->xpdo->errorCode() !== PDO::ERR_NONE) {
                                            $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, "Could not create index {$createIndexKey}: {$createIndex} " . print_r($this->xpdo->errorInfo(), true));
                Severity: Major
                Found in core/xpdo/om/sqlsrv/xpdomanager.class.php and 1 other location - About 3 hrs to fix
                core/xpdo/om/sqlite/xpdomanager.class.php on lines 169..178

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

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

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

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

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

                Refactorings

                Further Reading

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

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

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 134.

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

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

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

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

                Refactorings

                Further Reading

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

                    protected function getIndexDef($class, $name, $meta, array $options = array()) {
                        $result = '';
                        $index = isset($meta['columns']) ? $meta['columns'] : null;
                        if (is_array($index)) {
                            $indexset= array ();
                Severity: Major
                Found in core/xpdo/om/sqlsrv/xpdomanager.class.php and 1 other location - About 2 hrs to fix
                core/xpdo/om/sqlite/xpdomanager.class.php on lines 328..340

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

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

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

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

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

                Refactorings

                Further Reading

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

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

                Duplicated Code

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

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

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

                Tuning

                This issue has a mass of 118.

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

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

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

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

                Refactorings

                Further Reading

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

                                if ($result !== false || (!$result && $this->xpdo->errorCode() === '00000')) {
                                    $result = true;
                                } else {
                                    $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, "Error removing index {$name} from {$class}: " . print_r($this->xpdo->errorInfo(), true), '', __METHOD__, __FILE__, __LINE__);
                                }
                Severity: Major
                Found in core/xpdo/om/sqlsrv/xpdomanager.class.php and 2 other locations - About 1 hr to fix
                core/xpdo/om/sqlsrv/xpdomanager.class.php on lines 311..315
                core/xpdo/om/sqlsrv/xpdomanager.class.php on lines 335..339

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

                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 ($result !== false || (!$result && $this->xpdo->errorCode() === '00000')) {
                                    $result = true;
                                } else {
                                    $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, "Error removing field {$class}->{$name}: " . print_r($this->xpdo->errorInfo(), true), '', __METHOD__, __FILE__, __LINE__);
                                }
                Severity: Major
                Found in core/xpdo/om/sqlsrv/xpdomanager.class.php and 2 other locations - About 1 hr to fix
                core/xpdo/om/sqlsrv/xpdomanager.class.php on lines 311..315
                core/xpdo/om/sqlsrv/xpdomanager.class.php on lines 363..367

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

                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 ($result !== false || (!$result && $this->xpdo->errorCode() === '00000')) {
                                    $result = true;
                                } else {
                                    $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, "Error removing field {$class}->{$name}: " . print_r($this->xpdo->errorInfo(), true), '', __METHOD__, __FILE__, __LINE__);
                                }
                Severity: Major
                Found in core/xpdo/om/sqlsrv/xpdomanager.class.php and 2 other locations - About 1 hr to fix
                core/xpdo/om/sqlsrv/xpdomanager.class.php on lines 335..339
                core/xpdo/om/sqlsrv/xpdomanager.class.php on lines 363..367

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

                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