XoopsModules25x/adminer

View on GitHub
include/plugins/plugin.php

Summary

Maintainability
D
1 day
Test Coverage

AdminerPlugin has 59 functions (exceeds 20 allowed). Consider refactoring.
Open

class AdminerPlugin extends Adminer {
    /** @access protected */
    var $plugins;
    
    function _findRootClass($class) { // is_subclass_of(string, string) is available since PHP 5.0.3
Severity: Major
Found in include/plugins/plugin.php - About 1 day to fix

    File plugin.php has 269 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /** Adminer customization allowing usage of plugins
    * @link https://www.adminer.org/plugins/#use
    * @author Jakub Vrana, http://www.vrana.cz/
    Severity: Minor
    Found in include/plugins/plugin.php - About 2 hrs to fix

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

          function _applyPlugin($function, $args) {
              foreach ($this->plugins as $plugin) {
                  if (method_exists($plugin, $function)) {
                      switch (count($args)) { // call_user_func_array() doesn't work well with references
                          case 0: $return = $plugin->$function(); break;
      Severity: Minor
      Found in include/plugins/plugin.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 selectQueryBuild has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          function selectQueryBuild($select, $where, $group, $order, $limit, $page) {
      Severity: Minor
      Found in include/plugins/plugin.php - About 45 mins to fix

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

            function __construct($plugins) {
                if ($plugins === null) {
                    $plugins = array();
                    foreach (get_declared_classes() as $class) {
                        if (preg_match('~^Adminer.~i', $class) && strcasecmp($this->_findRootClass($class), 'Adminer')) { //! can use interface
        Severity: Minor
        Found in include/plugins/plugin.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