CORE-POS/IS4C

View on GitHub
fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.php

Summary

Maintainability
F
1 wk
Test Coverage
D
66%

Function WFC_Dark_ServiceCase_12UP has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

function WFC_Dark_ServiceCase_12UP ($data,$offset=0)
{
    $dbc = FannieDB::get(FannieConfig::config('OP_DB'));
    $pdf = new WFC_Dark_ServiceCase_12UP_PDF('L','mm','Letter');
    $pdf->AddPage();
Severity: Minor
Found in fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.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 generateMirrorTagServiceCase12 has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function generateMirrorTagServiceCase12($x, $y, $guide, $width, $height, $pdf, $row, $dbc)
{
    $upc = isset($row['upc']) ? $row['upc'] : '';
    $desc = isset($row['description']) ? $row['description'] : '';
    $size = isset($row['size']) ? $row['size'] : '';
Severity: Major
Found in fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.php - About 3 hrs to fix

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

    function generateServiceCaseTag($x, $y, $guide, $width, $height, $pdf, $row, $dbc)
    {
        $upc = $row['upc'];
        $desc = $row['description'];
        $showPrice = FormLib::get('showPrice', false);
    Severity: Major
    Found in fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.php - About 2 hrs to fix

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

      function WFC_Dark_ServiceCase_12UP ($data,$offset=0)
      {
          $dbc = FannieDB::get(FannieConfig::config('OP_DB'));
          $pdf = new WFC_Dark_ServiceCase_12UP_PDF('L','mm','Letter');
          $pdf->AddPage();
      Severity: Major
      Found in fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.php - About 2 hrs to fix

        File WFC_Dark_ServiceCase_12UP.php has 275 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        use COREPOS\Fannie\API\FanniePlugin;
        if (!class_exists('FpdfWithBarcode')) {
            include(dirname(__FILE__) . '/../FpdfWithBarcode.php');
        }
        Severity: Minor
        Found in fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.php - About 2 hrs to fix

          Method generateServiceCaseTag has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function generateServiceCaseTag($x, $y, $guide, $width, $height, $pdf, $row, $dbc)
          Severity: Major
          Found in fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.php - About 1 hr to fix

            Method generateMirrorTagServiceCase12 has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function generateMirrorTagServiceCase12($x, $y, $guide, $width, $height, $pdf, $row, $dbc)
            Severity: Major
            Found in fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.php - About 1 hr to fix

              Function stringToLines has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  static public function stringToLines($string) {
                      $length = strlen($string);
                      $lines = array();
                      // return 1 to 4 lines based on $desc size
                      if ($length < 21) {
              Severity: Minor
              Found in fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.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

              Method barcodeText has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function barcodeText($x, $y, $h, $barcode, $len)
              Severity: Minor
              Found in fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.php - About 35 mins to fix

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

                function generateMirrorTagServiceCase12($x, $y, $guide, $width, $height, $pdf, $row, $dbc)
                {
                    $upc = isset($row['upc']) ? $row['upc'] : '';
                    $desc = isset($row['description']) ? $row['description'] : '';
                    $size = isset($row['size']) ? $row['size'] : '';
                Severity: Minor
                Found in fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.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 generateServiceCaseTag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                function generateServiceCaseTag($x, $y, $guide, $width, $height, $pdf, $row, $dbc)
                {
                    $upc = $row['upc'];
                    $desc = $row['description'];
                    $showPrice = FormLib::get('showPrice', false);
                Severity: Minor
                Found in fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.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 3 locations. Consider refactoring.
                Open

                function WFC_Dark_ServiceCase_12UP ($data,$offset=0)
                {
                    $dbc = FannieDB::get(FannieConfig::config('OP_DB'));
                    $pdf = new WFC_Dark_ServiceCase_12UP_PDF('L','mm','Letter');
                    $pdf->AddPage();
                Severity: Major
                Found in fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.php and 2 other locations - About 4 days to fix
                fannie/admin/labels/pdf_layouts/WFC_Dark_HFM_12UP.php on lines 44..122
                fannie/admin/labels/pdf_layouts/WFC_Dark_Simple_24UP.php on lines 44..122

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

                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

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

                    if ($lineCount == 2) {
                        $pdf->SetXY($x,$y+12);
                        $pdf->Cell($width, 5, $lines[0], 0, 1, 'C', true); 
                        $pdf->SetXY($x, $y+19);
                        $pdf->Cell($width, 5, $lines[1], 0, 1, 'C', true); 
                Severity: Major
                Found in fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.php and 3 other locations - About 2 days to fix
                fannie/admin/labels/pdf_layouts/WFC_Dark_HFM_12UP.php on lines 230..254
                fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.php on lines 276..300
                fannie/admin/labels/pdf_layouts/WFC_Dark_Simple_24UP.php on lines 231..255

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

                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

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

                    if ($lineCount == 2) {
                        $pdf->SetXY($x,$y+12);
                        $pdf->Cell($width, 5, $lines[0], 0, 1, 'C', true); 
                        $pdf->SetXY($x, $y+19);
                        $pdf->Cell($width, 5, $lines[1], 0, 1, 'C', true); 
                Severity: Major
                Found in fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.php and 3 other locations - About 2 days to fix
                fannie/admin/labels/pdf_layouts/WFC_Dark_HFM_12UP.php on lines 230..254
                fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.php on lines 178..202
                fannie/admin/labels/pdf_layouts/WFC_Dark_Simple_24UP.php on lines 231..255

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

                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 3 locations. Consider refactoring.
                Open

                class WFC_Dark_ServiceCase_12UP_PDF extends FpdfWithBarcode
                {
                    private $tagdate;
                    public function setTagDate($str){
                        $this->tagdate = $str;
                fannie/admin/labels/pdf_layouts/WFC_Dark_HFM_12UP.php on lines 10..42
                fannie/admin/labels/pdf_layouts/WFC_Dark_Simple_24UP.php on lines 10..42

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

                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