CORE-POS/IS4C

View on GitHub
fannie/modules/plugins2.0/RP/RpDailyPage.php

Summary

Maintainability
F
1 wk
Test Coverage

File RpDailyPage.php has 470 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

use COREPOS\Fannie\API\lib\Operators as Op;
use COREPOS\Fannie\API\data\DataConvert; 

Severity: Minor
Found in fannie/modules/plugins2.0/RP/RpDailyPage.php - About 7 hrs to fix

    Function get_pdf_handler has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function get_pdf_handler()
        {
            $store = FormLib::get('store', COREPOS\Fannie\API\lib\Store::getIdByIp());
    
            $ts = time();
    Severity: Minor
    Found in fannie/modules/plugins2.0/RP/RpDailyPage.php - About 5 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 get_pdf_handler has 134 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function get_pdf_handler()
        {
            $store = FormLib::get('store', COREPOS\Fannie\API\lib\Store::getIdByIp());
    
            $ts = time();
    Severity: Major
    Found in fannie/modules/plugins2.0/RP/RpDailyPage.php - About 5 hrs to fix

      Method get_view has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function get_view()
          {
              $store = FormLib::get('store', COREPOS\Fannie\API\lib\Store::getIdByIp());
      
              $ts = time();
      Severity: Major
      Found in fannie/modules/plugins2.0/RP/RpDailyPage.php - About 2 hrs to fix

        Method greensTable has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function greensTable($store)
            {
                $res = $this->connection->query("
                    SELECT *
                    FROM RpGreens AS g
        Severity: Major
        Found in fannie/modules/plugins2.0/RP/RpDailyPage.php - About 2 hrs to fix

          Method prepsTable has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function prepsTable($store)
              {
                  $res = $this->connection->query("
                      SELECT *
                      FROM RpPreps AS g
          Severity: Major
          Found in fannie/modules/plugins2.0/RP/RpDailyPage.php - About 2 hrs to fix

            Method salesTable has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function salesTable($store, $ts)
                {
                    $segP = $this->connection->prepare("SELECT * FROM RpSegments WHERE storeID=? AND startDate=?");
                    if (date('N') == 1) {
                        $ts = mktime(0, 0, 0, date('n', $ts), date('j',$ts) - 7, date('Y',$ts));
            Severity: Major
            Found in fannie/modules/plugins2.0/RP/RpDailyPage.php - About 2 hrs to fix

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

                  protected function stockFirst($store)
                  {
                      $nameP = $this->connection->prepare("SELECT likeCodeDesc FROM likeCodes WHERE likeCode=?");
                      $batchP = $this->connection->prepare("SELECT l.batchID FROM batchList AS l
                          INNER JOIN batches AS b ON l.batchID=b.batchID
              Severity: Minor
              Found in fannie/modules/plugins2.0/RP/RpDailyPage.php - About 1 hr to fix

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

                    private function salesTable($store, $ts)
                    {
                        $segP = $this->connection->prepare("SELECT * FROM RpSegments WHERE storeID=? AND startDate=?");
                        if (date('N') == 1) {
                            $ts = mktime(0, 0, 0, date('n', $ts), date('j',$ts) - 7, date('Y',$ts));
                Severity: Minor
                Found in fannie/modules/plugins2.0/RP/RpDailyPage.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 prepsTable has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function prepsTable($store)
                    {
                        $res = $this->connection->query("
                            SELECT *
                            FROM RpPreps AS g
                Severity: Minor
                Found in fannie/modules/plugins2.0/RP/RpDailyPage.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 greensTable has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function greensTable($store)
                    {
                        $res = $this->connection->query("
                            SELECT *
                            FROM RpGreens AS g
                Severity: Minor
                Found in fannie/modules/plugins2.0/RP/RpDailyPage.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 stockFirst has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function stockFirst($store)
                    {
                        $nameP = $this->connection->prepare("SELECT likeCodeDesc FROM likeCodes WHERE likeCode=?");
                        $batchP = $this->connection->prepare("SELECT l.batchID FROM batchList AS l
                            INNER JOIN batches AS b ON l.batchID=b.batchID
                Severity: Minor
                Found in fannie/modules/plugins2.0/RP/RpDailyPage.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

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

                    private function prepsTable($store)
                    {
                        $res = $this->connection->query("
                            SELECT *
                            FROM RpPreps AS g
                Severity: Major
                Found in fannie/modules/plugins2.0/RP/RpDailyPage.php and 1 other location - About 2 days to fix
                fannie/modules/plugins2.0/RP/RpDailyPage.php on lines 326..390

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

                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

                    private function greensTable($store)
                    {
                        $res = $this->connection->query("
                            SELECT *
                            FROM RpGreens AS g
                Severity: Major
                Found in fannie/modules/plugins2.0/RP/RpDailyPage.php and 1 other location - About 2 days to fix
                fannie/modules/plugins2.0/RP/RpDailyPage.php on lines 392..456

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

                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

                            foreach ($stock as $row) {
                                $pdf->SetX($posX);
                                if (!empty($row[0])) {
                                    $pdf->Cell(60, 5, str_replace('bold', '', $row[0]), 1, 0, 'L');
                                    $pdf->Cell(20, 5, $header ? 'Qty' : '', 1, 0, 'L');
                Severity: Major
                Found in fannie/modules/plugins2.0/RP/RpDailyPage.php and 1 other location - About 3 hrs to fix
                fannie/modules/plugins2.0/RP/RpDailyPage.php on lines 170..180

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

                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

                            foreach ($sale as $row) {
                                $pdf->SetX($posX);
                                if (!empty($row[0])) {
                                    $pdf->Cell(60, 5, str_replace('bold', '', $row[0]), 1, 0, 'L');
                                    $pdf->Cell(20, 5, $header ? 'Qty' : '', 1, 0, 'L');
                Severity: Major
                Found in fannie/modules/plugins2.0/RP/RpDailyPage.php and 1 other location - About 3 hrs to fix
                fannie/modules/plugins2.0/RP/RpDailyPage.php on lines 154..164

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

                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

                        foreach ($preps as $row) {
                            $pdf->SetX(5);
                            if (!empty($row[0])) {
                                $pdf->Cell(50, 7, str_replace('bold', '', $row[0]), 1, 0, 'L');
                                $pdf->Cell(13, 7, str_replace('bold', '', $row[1]), 1, 1, 'L');
                Severity: Major
                Found in fannie/modules/plugins2.0/RP/RpDailyPage.php and 1 other location - About 1 hr to fix
                fannie/modules/plugins2.0/RP/RpDailyPage.php on lines 113..119

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

                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

                        foreach ($greens as $row) {
                            $pdf->SetX(83);
                            if (!empty($row[0])) {
                                $pdf->Cell(50, 7, str_replace('bold', '', $row[0]), 1, 0, 'L');
                                $pdf->Cell(13, 7, str_replace('bold', '', $row[1]), 1, 1, 'L');
                Severity: Major
                Found in fannie/modules/plugins2.0/RP/RpDailyPage.php and 1 other location - About 1 hr to fix
                fannie/modules/plugins2.0/RP/RpDailyPage.php on lines 103..109

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

                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