CORE-POS/IS4C

View on GitHub
fannie/classlib2.0/item/HobartDgwLib.php

Summary

Maintainability
F
4 days
Test Coverage
F
17%

Function writeItemsToScales has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

    static public function writeItemsToScales($items, $scales=array())
    {
        $config = \FannieConfig::factory(); 
        if (!isset($items[0])) {
            $items = array($items);
Severity: Minor
Found in fannie/classlib2.0/item/HobartDgwLib.php - About 1 day 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 readItemsFromFile has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    static public function readItemsFromFile($filename)
    {
        $dbc = \FannieDB::get(\FannieConfig::factory()->get('OP_DB'));

        $product = new \ProductsModel($dbc);
Severity: Minor
Found in fannie/classlib2.0/item/HobartDgwLib.php - About 4 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 writeItemsToScales has 98 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    static public function writeItemsToScales($items, $scales=array())
    {
        $config = \FannieConfig::factory(); 
        if (!isset($items[0])) {
            $items = array($items);
Severity: Major
Found in fannie/classlib2.0/item/HobartDgwLib.php - About 3 hrs to fix

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

        static public function getItemLine($item_info, $scaleType='HOBART_QUANTUMTCP')
        {
            $line = '';
            // first write fields that are present
            foreach(ServiceScaleLib::$WRITE_ITEM_FIELDS as $key => $field_info) {
    Severity: Minor
    Found in fannie/classlib2.0/item/HobartDgwLib.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

    File HobartDgwLib.php has 308 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*******************************************************************************
    
        Copyright 2014 Whole Foods Co-op, Duluth, MN
    
    
    Severity: Minor
    Found in fannie/classlib2.0/item/HobartDgwLib.php - About 3 hrs to fix

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

          static public function readItemsFromFile($filename)
          {
              $dbc = \FannieDB::get(\FannieConfig::factory()->get('OP_DB'));
      
              $product = new \ProductsModel($dbc);
      Severity: Major
      Found in fannie/classlib2.0/item/HobartDgwLib.php - About 2 hrs to fix

        Function deleteItemsFromScales has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            static public function deleteItemsFromScales($items, $scales=array())
            {
                $config = \FannieConfig::factory(); 
        
                if (!is_array($items)) {
        Severity: Minor
        Found in fannie/classlib2.0/item/HobartDgwLib.php - About 2 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 deleteItemsFromScales has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            static public function deleteItemsFromScales($items, $scales=array())
            {
                $config = \FannieConfig::factory(); 
        
                if (!is_array($items)) {
        Severity: Minor
        Found in fannie/classlib2.0/item/HobartDgwLib.php - About 1 hr to fix

          Function readTextsFromFile has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              static public function readTextsFromFile($filename)
              {
                  $dbc = \FannieDB::get(\FannieConfig::factory()->get('OP_DB'));
          
                  $product = new \ProductsModel($dbc);
          Severity: Minor
          Found in fannie/classlib2.0/item/HobartDgwLib.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 readTextsFromFile has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              static public function readTextsFromFile($filename)
              {
                  $dbc = \FannieDB::get(\FannieConfig::factory()->get('OP_DB'));
          
                  $product = new \ProductsModel($dbc);
          Severity: Minor
          Found in fannie/classlib2.0/item/HobartDgwLib.php - About 1 hr to fix

            Method getItemLine has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                static public function getItemLine($item_info, $scaleType='HOBART_QUANTUMTCP')
                {
                    $line = '';
                    // first write fields that are present
                    foreach(ServiceScaleLib::$WRITE_ITEM_FIELDS as $key => $field_info) {
            Severity: Minor
            Found in fannie/classlib2.0/item/HobartDgwLib.php - About 1 hr to fix

              There are no issues that match your filters.

              Category
              Status