plugins/conf/admin_modules/yf_settings.class.php

Summary

Maintainability
C
1 day
Test Coverage

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

    public function _prepare_to_save($a)
    {
        $to_save = [];
        foreach ((array) $a as $k => $v) {
            if (is_string($v) && ! strlen($v)) {
Severity: Minor
Found in plugins/conf/admin_modules/yf_settings.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

Method display_what has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function display_what()
    {
        $hooks_data = _class('admin_methods')->call_hooks('settings', $r);
        $avail_hook_modules = [];
        foreach ((array) $hooks_data as $k => $v) {
Severity: Major
Found in plugins/conf/admin_modules/yf_settings.class.php - About 2 hrs to fix

    Function display_what has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public function display_what()
        {
            $hooks_data = _class('admin_methods')->call_hooks('settings', $r);
            $avail_hook_modules = [];
            foreach ((array) $hooks_data as $k => $v) {
    Severity: Minor
    Found in plugins/conf/admin_modules/yf_settings.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 _prepare_to_save has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function _prepare_to_save($a)
        {
            $to_save = [];
            foreach ((array) $a as $k => $v) {
                if (is_string($v) && ! strlen($v)) {
    Severity: Minor
    Found in plugins/conf/admin_modules/yf_settings.class.php - About 1 hr to fix

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

          public function show()
          {
              $r = [];
              foreach ((array) conf() as $k => $v) {
                  if (is_array($v)) {
      Severity: Minor
      Found in plugins/conf/admin_modules/yf_settings.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 _get_settings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function _get_settings($hooks_data)
          {
              $settings = db()->from('settings')->order_by('`order`, item ASC')->get_all();
              if ( ! $settings && $hooks_data) {
                  $settings = [];
      Severity: Minor
      Found in plugins/conf/admin_modules/yf_settings.class.php - About 25 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