CORE-POS/IS4C

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

Summary

Maintainability
F
1 wk
Test Coverage
C
70%

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

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

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

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

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

      Method generateMirrorTagSimple has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function generateMirrorTagSimple($x, $y, $guide, $width, $height, $pdf, $row, $dbc)
      {
          $upc = isset($row['upc']) ? $row['upc'] : '';
          $desc = isset($row['description']) ? $row['description'] : '';
          $brand = isset($row['brand']) ? $row['brand'] : '';
      Severity: Minor
      Found in fannie/admin/labels/pdf_layouts/WFC_Dark_Simple_24UP.php - About 1 hr to fix

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

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

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

          function generateMirrorTagSimple($x, $y, $guide, $width, $height, $pdf, $row, $dbc)
          Severity: Major
          Found in fannie/admin/labels/pdf_layouts/WFC_Dark_Simple_24UP.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 < 22) {
            Severity: Minor
            Found in fannie/admin/labels/pdf_layouts/WFC_Dark_Simple_24UP.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_Simple_24UP.php - About 35 mins to fix

              Function generateSimpleTag2 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              function generateSimpleTag2($x, $y, $guide, $width, $height, $pdf, $row, $dbc)
              {
                  $upc = $row['upc'];
                  $desc = $row['description'];
                  $args = array($row['upc']);
              Severity: Minor
              Found in fannie/admin/labels/pdf_layouts/WFC_Dark_Simple_24UP.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_Simple_24UP ($data,$offset=0)
              {
                  $dbc = FannieDB::get(FannieConfig::config('OP_DB'));
                  $pdf = new WFC_Dark_Simple_24UP_PDF('L','mm','Letter');
                  $pdf->AddPage();
              Severity: Major
              Found in fannie/admin/labels/pdf_layouts/WFC_Dark_Simple_24UP.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_ServiceCase_12UP.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_Simple_24UP.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_ServiceCase_12UP.php on lines 276..300

              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_Simple_24UP_PDF extends FpdfWithBarcode
              {
                  private $tagdate;
                  public function setTagDate($str){
                      $this->tagdate = $str;
              Severity: Major
              Found in fannie/admin/labels/pdf_layouts/WFC_Dark_Simple_24UP.php and 2 other locations - About 1 day to fix
              fannie/admin/labels/pdf_layouts/WFC_Dark_HFM_12UP.php on lines 10..42
              fannie/admin/labels/pdf_layouts/WFC_Dark_ServiceCase_12UP.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