xoopscube/altsys

View on GitHub
xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php

Summary

Maintainability
F
6 days
Test Coverage

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

<?php
/**
 * Altsys library (UI-Components) Admin blocks and permissions
 * Class MyBlocksAdmin
 * @package    Altsys
Severity: Major
Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 1 day to fix

    Method form_edit has 99 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function form_edit( $bid, $mode = 'edit' ) {
            $bid = (int) $bid;
    
            //HACK by domifara
            if ( defined( 'XOOPS_CUBE_LEGACY' ) ) {
    Severity: Major
    Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 3 hrs to fix

      Function update_block has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          public function update_block( $bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $options = [] ) {
              global $xoopsConfig;
      
              //HACK by domifara
              if ( defined( 'XOOPS_CUBE_LEGACY' ) ) {
      Severity: Minor
      Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.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

      MyBlocksAdmin has 31 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class MyBlocksAdmin {
          public $db;
      
          public $lang;
      
      
      Severity: Minor
      Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 3 hrs to fix

        Method renderCell4BlockPosition has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function renderCell4BlockPosition( $block_data ) {
                $bid     = (int) $block_data['bid'];
                $side    = (int) $block_data['side'];
                $visible = (int) $block_data['visible'];
        
        
        Severity: Major
        Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 2 hrs to fix

          Method list_blocks has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function list_blocks() {
                  global $xoopsGTicket;
          
                  // main query
                  $sql       = 'SELECT * FROM ' . $this->db->prefix( 'newblocks' ) . " WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight";
          Severity: Major
          Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 2 hrs to fix

            Method update_block has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function update_block( $bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $options = [] ) {
                    global $xoopsConfig;
            
                    //HACK by domifara
                    if ( defined( 'XOOPS_CUBE_LEGACY' ) ) {
            Severity: Minor
            Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 2 hrs to fix

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

                  public function do_clone( $bid ) {
                      $bid = (int) $bid;
              
                      $request = $this->fetchRequest4Block( $bid );
              
              
              Severity: Minor
              Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 1 hr to fix

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

                    public function form_edit( $bid, $mode = 'edit' ) {
                        $bid = (int) $bid;
                
                        //HACK by domifara
                        if ( defined( 'XOOPS_CUBE_LEGACY' ) ) {
                Severity: Minor
                Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.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 init has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function init( $xoopsModule ) {
                        // altsys "module" MODE
                
                        if ( 'altsys' == $xoopsModule->getVar( 'dirname' ) ) {
                            // set target_module if specified by $_GET['dirname']
                Severity: Minor
                Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 1 hr to fix

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

                      public function do_clone( $bid ) {
                          $bid = (int) $bid;
                  
                          $request = $this->fetchRequest4Block( $bid );
                  
                  
                  Severity: Minor
                  Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.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 canClone has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function canClone( $block ) {
                          // can clone link if it is marked as cloneable block
                          if ( 'D' == $block->getVar( 'block_type' ) || 'C' == $block->getVar( 'block_type' ) ) {
                              return 2;
                          }
                  Severity: Minor
                  Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.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 renderCell4BlockReadGroupPerm has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function renderCell4BlockReadGroupPerm( $block_data ) {
                          $bid = (int) $block_data['bid'];
                  
                          // get selected targets
                          if ( is_array( @$block_data['bgroup'] ) ) {
                  Severity: Minor
                  Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.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 update_block has 9 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function update_block( $bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $options = [] ) {
                  Severity: Major
                  Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 1 hr to fix

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

                        public function construct() {
                            $this->db =& XoopsDatabaseFactory::getDatabaseConnection();
                    
                            $this->lang = @$GLOBALS['xoopsConfig']['language'];
                    
                    
                    Severity: Minor
                    Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 1 hr to fix

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

                          public function list_groups() {
                              // query for getting blocks
                              $sql       = 'SELECT * FROM ' . $this->db->prefix( 'newblocks' ) . " WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight";
                              $result    = $this->db->query( $sql );
                              $block_arr = [];
                      Severity: Minor
                      Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 1 hr to fix

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

                            public function renderCell4BlockModuleLink( $block_data ) {
                                $bid = (int) $block_data['bid'];
                        
                                // get selected targets
                                if ( is_array( @$block_data['bmodule'] ) ) {
                        Severity: Minor
                        Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 1 hr to fix

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

                              public function renderCell4BlockModuleLink( $block_data ) {
                                  $bid = (int) $block_data['bid'];
                          
                                  // get selected targets
                                  if ( is_array( @$block_data['bmodule'] ) ) {
                          Severity: Minor
                          Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.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 renderCell4BlockReadGroupPerm has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function renderCell4BlockReadGroupPerm( $block_data ) {
                                  $bid = (int) $block_data['bid'];
                          
                                  // get selected targets
                                  if ( is_array( @$block_data['bgroup'] ) ) {
                          Severity: Minor
                          Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.class.php - About 1 hr to fix

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

                                public function renderCell4BlockPosition( $block_data ) {
                                    $bid     = (int) $block_data['bid'];
                                    $side    = (int) $block_data['side'];
                                    $visible = (int) $block_data['visible'];
                            
                            
                            Severity: Minor
                            Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.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

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

                                public function processPost() {
                                    // Ticket Check
                                    if ( ! $GLOBALS['xoopsGTicket']->check( true, 'myblocksadmin' ) ) {
                                        redirect_header( XOOPS_URL . '/', 3, $GLOBALS['xoopsGTicket']->getErrors() );
                                    }
                            Severity: Minor
                            Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.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

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

                                public function list_groups() {
                                    // query for getting blocks
                                    $sql       = 'SELECT * FROM ' . $this->db->prefix( 'newblocks' ) . " WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight";
                                    $result    = $this->db->query( $sql );
                                    $block_arr = [];
                            Severity: Minor
                            Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.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

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

                                public function init( $xoopsModule ) {
                                    // altsys "module" MODE
                            
                                    if ( 'altsys' == $xoopsModule->getVar( 'dirname' ) ) {
                                        // set target_module if specified by $_GET['dirname']
                            Severity: Minor
                            Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.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 list_blocks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function list_blocks() {
                                    global $xoopsGTicket;
                            
                                    // main query
                                    $sql       = 'SELECT * FROM ' . $this->db->prefix( 'newblocks' ) . " WHERE mid='$this->target_mid' ORDER BY visible DESC,side,weight";
                            Severity: Minor
                            Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.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 do_edit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function do_edit( $bid ) {
                                    $bid = (int) $bid;
                            
                                    if ( $bid <= 0 ) {
                                        // new custom block
                            Severity: Minor
                            Found in xoops_trust_path/libs/altsys/class/MyBlocksAdmin.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

                            There are no issues that match your filters.

                            Category
                            Status