CORE-POS/IS4C

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

Summary

Maintainability
F
1 wk
Test Coverage

Function WFC_Hybrid_Single has a Cognitive Complexity of 109 (exceeds 5 allowed). Consider refactoring.
Open

function WFC_Hybrid_Single($data,$offset=0){

$pdf=new WFC_Hybrid_Single_PDF('L','mm',array(25.4, 53.975)); //start new instance of PDF
$pdf->Open(); //open new PDF Document
$pdf->setTagDate(date("m/d/Y"));
Severity: Minor
Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid_Single.php - About 2 days 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 WFC_Hybrid_Single has 326 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function WFC_Hybrid_Single($data,$offset=0){

$pdf=new WFC_Hybrid_Single_PDF('L','mm',array(25.4, 53.975)); //start new instance of PDF
$pdf->Open(); //open new PDF Document
$pdf->setTagDate(date("m/d/Y"));
Severity: Major
Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid_Single.php - About 1 day to fix

    File WFC_Hybrid_Single.php has 387 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    if (!class_exists('FpdfWithBarcode')) {
        include(dirname(__FILE__) . '/../FpdfWithBarcode.php');
    }
    if (!class_exists('FpdfLib')) {
    Severity: Minor
    Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid_Single.php - About 5 hrs to fix

      Method Ellipse has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function Ellipse($x, $y, $rx, $ry, $style='D')
          {
              if($style=='F')
                  $op='f';
              elseif($style=='FD' || $style=='DF')
      Severity: Minor
      Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid_Single.php - About 1 hr to fix

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

            function Ellipse($x, $y, $rx, $ry, $style='D')
        Severity: Minor
        Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid_Single.php - About 35 mins to fix

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

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

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

            class WFC_Hybrid_Single_PDF extends FpdfWithBarcode
            {
                private $tagdate;
                function setTagDate($str){
                    $this->tagdate = $str;
            Severity: Major
            Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid_Single.php and 1 other location - About 4 days to fix
            fannie/admin/labels/pdf_layouts/WFC_Hybrid.php on lines 32..86

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

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

                    foreach ($words as $word) {
                       if ($curCnt == 0) {
                           $curStr .= $word . " ";
                           $length += strlen($word)+1;
                       } elseif ($curCnt == 1 && ($length + strlen($word) + 1) < 17) {
            Severity: Major
            Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid_Single.php and 1 other location - About 4 hrs to fix
            fannie/admin/labels/pdf_layouts/WFC_Hybrid.php on lines 443..459

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

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

                    if (count(isset($locations[$upc]) ? $locations[$upc] : array()) > 1 && $store == 2) {
                        $pdf->SetFillColor(255, 100, 0); // orange
                        $pdf->Circle($baseX+27.5, $baseY-7.5, 1.25, 'F');
                        $pdf->SetTextColor(255,255,255);
                        $pdf->SetFontSize(6);
            Severity: Major
            Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid_Single.php and 1 other location - About 3 hrs to fix
            fannie/admin/labels/pdf_layouts/WFC_Hybrid.php on lines 499..507

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

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

                    if ($dots[$upc] == 'REFRIGERATED' && $store == 2) {
                        $pdf->SetFillColor(0, 100, 255); // blue
                        $pdf->Circle($baseX+27.5, $baseY-10, 1.25, 'F');
                        $pdf->SetFillColor(255,255,255);
                        $pdf->SetTextColor(255,255,255);
            Severity: Major
            Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid_Single.php and 1 other location - About 3 hrs to fix
            fannie/admin/labels/pdf_layouts/WFC_Hybrid.php on lines 476..485

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

            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($dots[$upc]) && $dots[$upc] == 'PRODUCE') {
                        $pdf->SetFillColor(0, 255, 100); // green 
                        $pdf->Circle($full_x+48.0, $full_y+9.5, 1.25, 'F');
                        $pdf->SetFillColor(255,255,255);
                        $pdf->SetTextColor(255,255,255);
            Severity: Major
            Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid_Single.php and 1 other location - About 3 hrs to fix
            fannie/admin/labels/pdf_layouts/WFC_Hybrid.php on lines 286..294

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

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

            foreach ($data as $k => $row) {
                if ($dbc->getValue($narrowP, array($row['upc'], $store))) {
                    $row['full'] = false;
                    $row['movementTag'] = $dbc->getValue($mtP, array($row['upc'], $store));
                    $half[] = $row;
            Severity: Major
            Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid_Single.php and 1 other location - About 3 hrs to fix
            fannie/admin/labels/pdf_layouts/WFC_Hybrid.php on lines 165..175

            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

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

                    if (isset($dots[$upc]) && $dots[$upc] == 'PRODUCE') {
                        $pdf->SetFillColor(0, 255, 100); // green
                        $pdf->Circle($baseX+27.5, $baseY-10, 1.25, 'F');
            
                        $pdf->SetTextColor(255,255,255);
            Severity: Major
            Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid_Single.php and 1 other location - About 2 hrs to fix
            fannie/admin/labels/pdf_layouts/WFC_Hybrid.php on lines 488..496

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

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

                    foreach ($words as $word) {
                        if ($length + strlen($word) <= $limit) {
                            $curStr .= $word . ' ';
                            $length += strlen($word) + 1;
                        } else {
            Severity: Major
            Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid_Single.php and 2 other locations - About 1 hr to fix
            fannie/admin/labels/pdf_layouts/WFC_Hybrid.php on lines 418..430
            fannie/admin/labels/pdf_layouts/WFC_Narrow.php on lines 111..123

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

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

            while ($row = $dbc->fetchRow($res)) {
                $upc = ltrim($row['upc'],0);
                $locations[$upc][] = ($row['location'] != null) ? $row['location'] : $row['noSubLocation'];
                $locNames[$upc][] = $row['name'];
            }
            Severity: Minor
            Found in fannie/admin/labels/pdf_layouts/WFC_Hybrid_Single.php and 1 other location - About 30 mins to fix
            fannie/admin/labels/pdf_layouts/WFC_Hybrid.php on lines 129..133

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

            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