Function getUpdateItemLine
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
static private function getUpdateItemLine($item_info, $labelInfo)
{
$line = 'CCOSPIC' . chr(253);
foreach (ServiceScaleLib::$WRITE_ITEM_FIELDS as $key => $field_info) {
if (isset($item_info[$key])) {
- Read upRead up
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 EpScaleLib.php
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2014 Whole Foods Co-op, Duluth, MN
Function deleteItemsFromScales
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
static public function deleteItemsFromScales($items, $scales=array())
{
$config = \FannieConfig::factory();
$dbc = \FannieDB::get($config->get('OP_DB'));
- Read upRead up
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 getUpdateItemLine
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
static private function getUpdateItemLine($item_info, $labelInfo)
{
$line = 'CCOSPIC' . chr(253);
foreach (ServiceScaleLib::$WRITE_ITEM_FIELDS as $key => $field_info) {
if (isset($item_info[$key])) {
Method getAddItemLine
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
static private function getAddItemLine($item_info, $labelInfo)
{
$line = 'CCOSPIA' . chr(253);
$line .= 'PNO' . $item_info['PLU'] . chr(253);
$line .= 'UPC' . ServiceScaleLib::pluToUPC($item_info['PLU']) . chr(253);
Method deleteItemsFromScales
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
static public function deleteItemsFromScales($items, $scales=array())
{
$config = \FannieConfig::factory();
$dbc = \FannieDB::get($config->get('OP_DB'));
Function writeItemsToScales
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
static public function writeItemsToScales($items, $scales=array(), $asNew=true)
{
$config = \FannieConfig::factory();
if (!isset($items[0])) {
$items = array($items);
- Read upRead up
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 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
static public function writeItemsToScales($items, $scales=array(), $asNew=true)
{
$config = \FannieConfig::factory();
if (!isset($items[0])) {
$items = array($items);
Function getItemLine
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static public function getItemLine($item_info, $scale_model, $asNew)
{
$scale_fields = '';
if ($scale_model->epStoreNo() != 0) {
$scale_fields .= 'SNO' . $scale_model->epStoreNo() . chr(253);
- Read upRead up
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"