amtgard/ORK3

View on GitHub
system/lib/Yapo2/Driver/structure.PostgreSql.YapoNestedSetTree.php

Summary

Maintainability
F
1 mo
Test Coverage

File structure.PostgreSql.YapoNestedSetTree.php has 423 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

include_once(Yapo::$DIR_DRIVER . '/structure.Interface.YapoNestedSetTree.php');

class PostgresqlYapoNestedSetTree extends InterfaceYapoNestedSetTree {
Severity: Minor
Found in system/lib/Yapo2/Driver/structure.PostgreSql.YapoNestedSetTree.php - About 6 hrs to fix

    Method move has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function move($node_id, $parent_node_id) {
            $this->beginTransaction();
            
            try {
                $this->clear();
    Severity: Major
    Found in system/lib/Yapo2/Driver/structure.PostgreSql.YapoNestedSetTree.php - About 2 hrs to fix

      Method promote has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function promote($mtvalue = null) {
              if (is_null($mtvalue))
                  return false;
                  
              $this->beginTransaction();
      Severity: Minor
      Found in system/lib/Yapo2/Driver/structure.PostgreSql.YapoNestedSetTree.php - About 1 hr to fix

        Method insert has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function insert($node_id, $insert_parent_id) {
                $this->beginTransaction();
                
                try {
                    $this->clear();
        Severity: Minor
        Found in system/lib/Yapo2/Driver/structure.PostgreSql.YapoNestedSetTree.php - About 1 hr to fix

          Method excise has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function excise() {
                  $this->beginTransaction();
                  
                  try {
                      $tree_id = $this->pkvalue();
          Severity: Minor
          Found in system/lib/Yapo2/Driver/structure.PostgreSql.YapoNestedSetTree.php - About 1 hr to fix

            Method _save_child has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function _save_child(& $yapo, $child, $insert_left = false) {
                    $insert_left = $insert_left ? $insert_left : $this->leftvalue();
                    $mtvalue = $this->mtvalue();
                    $mtdata = array();
                    if ($this->multitree()) {
            Severity: Minor
            Found in system/lib/Yapo2/Driver/structure.PostgreSql.YapoNestedSetTree.php - About 1 hr to fix

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

                  function delete() {
                      $this->beginTransaction();
                      
                      try {
                          $Data = array( );
              Severity: Minor
              Found in system/lib/Yapo2/Driver/structure.PostgreSql.YapoNestedSetTree.php - About 1 hr to fix

                Method children has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function children($gt = null) {
                        $tree_id = $this->pkvalue();
                        $Data = array( ':tree_id' => $tree_id );
                        if ($this->multitree()) {
                            $mtselect = "and node.\"" . $this->multitree() . "\" = :mtvalue and parent.\"" . $this->multitree() . "\" = :mtvalue";
                Severity: Minor
                Found in system/lib/Yapo2/Driver/structure.PostgreSql.YapoNestedSetTree.php - About 1 hr to fix

                  Method depthsound has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function depthsound() {
                          $tree_id = $this->pkvalue();
                          $Data = array( ':tree_id' => $tree_id );
                          if ($this->multitree()) {
                              $mtselect = "and node.\"" . $this->multitree() . "\" = :mtvalue and parent.\"" . $this->multitree() . "\" = :mtvalue";
                  Severity: Minor
                  Found in system/lib/Yapo2/Driver/structure.PostgreSql.YapoNestedSetTree.php - About 1 hr to fix

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

                        function __construct(& $database, $table, $left_field, $right_field, $tree_field = null) {
                    Severity: Minor
                    Found in system/lib/Yapo2/Driver/structure.PostgreSql.YapoNestedSetTree.php - About 35 mins to fix

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

                      <?php
                      
                      include_once(Yapo::$DIR_DRIVER . '/structure.Interface.YapoNestedSetTree.php');
                      
                      class PostgresqlYapoNestedSetTree extends InterfaceYapoNestedSetTree {
                      system/lib/Yapo2/Driver/structure.Mysql.YapoNestedSetTree.php on lines 1..523

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

                      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