CORE-POS/IS4C

View on GitHub
fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php

Summary

Maintainability
F
6 days
Test Coverage

Function getTopImage has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

    private function getTopImage($item)
    {
        // Manual Signs Page && smartType override checked takes precedence
        if (isset($item['smartType']) && $item['smartType'] == 'CoopDeals') {
            return __DIR__ . '/noauto/images/codeals_top_2.png';
Severity: Minor
Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 6 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

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

    private function getBottomImage($item)
    {
        // Manual Signs Page && smartType override checked takes precedence
        if (isset($item['smartType']) && $item['smartType'] == 'CoopDeals') {
            return __DIR__ . '/cd_line_16.png';
Severity: Minor
Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.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

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

    public function drawPDF()
    {
        $pdf = $this->createPDF();
        $dbc = FannieDB::get(FannieConfig::config('OP_DB'));
        $basicP = $dbc->prepare("SELECT
Severity: Major
Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 2 hrs to fix

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

        public function drawPDF()
        {
            $pdf = $this->createPDF();
            $dbc = FannieDB::get(FannieConfig::config('OP_DB'));
            $basicP = $dbc->prepare("SELECT
    Severity: Minor
    Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.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 getTopImage has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function getTopImage($item)
        {
            // Manual Signs Page && smartType override checked takes precedence
            if (isset($item['smartType']) && $item['smartType'] == 'CoopDeals') {
                return __DIR__ . '/noauto/images/codeals_top_2.png';
    Severity: Minor
    Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 1 hr to fix

      Method getBottomImage has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function getBottomImage($item)
          {
              // Manual Signs Page && smartType override checked takes precedence
              if (isset($item['smartType']) && $item['smartType'] == 'CoopDeals') {
                  return __DIR__ . '/cd_line_16.png';
      Severity: Minor
      Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 1 hr to fix

        Avoid too many return statements within this method.
        Open

                    return __DIR__ . '/noauto/images/organic_top_12.png';
        Severity: Major
        Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return __DIR__ . '/noauto/images/local-top.png';
          Severity: Major
          Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return __DIR__ . '/noauto/images/freshdeals_top_4.png';
            Severity: Major
            Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return __DIR__ . '/noauto/images/local_og_bottom.png';
              Severity: Major
              Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return __DIR__ . '/noauto/images/local_og_top.png';
                Severity: Major
                Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return __DIR__ . '/noauto/images/organic_bottom_12.png';
                  Severity: Major
                  Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return __DIR__ . '/cd_line_16.png';
                    Severity: Major
                    Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return __DIR__ . '/noauto/images/local-top.png';
                      Severity: Major
                      Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return __DIR__ . '/noauto/images/organic_top_12.png';
                        Severity: Major
                        Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return __DIR__ . '/noauto/images/basics_bottom_12.png';
                          Severity: Major
                          Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return __DIR__ . '/noauto/images/chaching_top_2.png';
                            Severity: Major
                            Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                          return __DIR__ . '/noauto/images/chaching_bottom_12.png';
                              Severity: Major
                              Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                            return __DIR__ . '/noauto/images/freshdeals_bottom_4.png';
                                Severity: Major
                                Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                          return __DIR__ . '/noauto/images/standard_bottom_12.png';
                                  Severity: Major
                                  Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                return __DIR__ . '/noauto/images/basics_top_12.png';
                                    Severity: Major
                                    Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                              return __DIR__ . '/noauto/images/standard_top_12.png';
                                      Severity: Major
                                      Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                    return __DIR__ . '/noauto/images/local_og_top.png';
                                        Severity: Major
                                        Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                      return __DIR__ . '/noauto/images/organic_bottom_12.png';
                                          Severity: Major
                                          Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                        return __DIR__ . '/noauto/images/codeals_top_2.png';
                                            Severity: Major
                                            Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                          return __DIR__ . '/noauto/images/local-bottom.png';
                                              Severity: Major
                                              Found in fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php - About 30 mins to fix

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

                                                            if ($count % 4 == 0) {
                                                                if ($count != 0) {
                                                                    // draw tick marks again
                                                                    // sometimes other content of the page
                                                                    // overwrites them
                                                fannie/modules/plugins2.0/CoopDealsSigns/WfcSmartSigns4UpP.php on lines 53..76

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

                                                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

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

                                                        if (isset($item['batchName']) && strstr($item['batchName'], 'Co-op Deals') && !strstr($item['batchName'], 'TPR')) {
                                                            return __DIR__ . '/noauto/images/codeals_top_2.png';
                                                        } elseif (isset($item['batchName']) && strstr(strtoupper($item['batchName']), 'FRESH DEALS')) {
                                                            return __DIR__ . '/noauto/images/freshdeals_top_4.png';
                                                        } elseif (!empty($item['batchName'])) {
                                                fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php on lines 158..172

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

                                                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

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

                                                        if (isset($item['batchName']) && strstr($item['batchName'], 'Co-op Deals') && !strstr($item['batchName'], 'TPR')) {
                                                            return __DIR__ . '/cd_line_16.png';
                                                        } elseif (isset($item['batchName']) && strstr(strtoupper($item['batchName']), 'FRESH DEALS')) {
                                                            return __DIR__ . '/noauto/images/freshdeals_bottom_4.png';
                                                        } elseif (!empty($item['batchName'])) {
                                                fannie/modules/plugins2.0/CoopDealsSigns/LegacySmartSigns4UpL.php on lines 124..138

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

                                                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