plugins/charts/classes/yf_charts.class.php

Summary

Maintainability
C
1 day
Test Coverage

Function jquery_sparklines has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    public function jquery_sparklines($data, $extra = [])
    {
        $extra['id'] = $extra['id'] ?: __FUNCTION__ . '_' . ++$this->_ids[__FUNCTION__];
        if ( ! is_array($data) || ! $data) {
            return false;
Severity: Minor
Found in plugins/charts/classes/yf_charts.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 jquery_sparklines has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function jquery_sparklines($data, $extra = [])
    {
        $extra['id'] = $extra['id'] ?: __FUNCTION__ . '_' . ++$this->_ids[__FUNCTION__];
        if ( ! is_array($data) || ! $data) {
            return false;
Severity: Minor
Found in plugins/charts/classes/yf_charts.class.php - About 1 hr to fix

    Method chart_flash has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function chart_flash($data, $params)
        {
            if (empty($data)) {
                return;
            }
    Severity: Minor
    Found in plugins/charts/classes/yf_charts.class.php - About 1 hr to fix

      Method chart has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function chart($data, $params)
          {
              if ($params['flash'] == true) {
                  return $this->chart_flash($data, $params);
              }
      Severity: Minor
      Found in plugins/charts/classes/yf_charts.class.php - About 1 hr to fix

        Method chart_bar_flash has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function chart_bar_flash($data, $params)
            {
                if (empty($data)) {
                    return;
                }
        Severity: Minor
        Found in plugins/charts/classes/yf_charts.class.php - About 1 hr to fix

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

              public function chart($data, $params)
              {
                  if ($params['flash'] == true) {
                      return $this->chart_flash($data, $params);
                  }
          Severity: Minor
          Found in plugins/charts/classes/yf_charts.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 _get_ticks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function _get_ticks($data)
              {
                  $max = 0;
                  foreach ((array) $data as $val) {
                      if ($val['val'] > $max) {
          Severity: Minor
          Found in plugins/charts/classes/yf_charts.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 chart_bar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              public function chart_bar($data, $params)
              {
                  if ($params['flash'] == true) {
                      return $this->chart_bar_flash($data, $params);
                  }
          Severity: Minor
          Found in plugins/charts/classes/yf_charts.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