File BaseItemModule.php
has 1175 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2013 Whole Foods Co-op, Duluth, MN
Method showEditForm
has 489 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function showEditForm($upc, $display_mode=1, $expand_mode=1)
{
$FANNIE_PRODUCT_MODULES = FannieConfig::config('PRODUCT_MODULES', array());
$upc = BarcodeLib::padUPC($upc);
Function showEditForm
has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring. Open
public function showEditForm($upc, $display_mode=1, $expand_mode=1)
{
$FANNIE_PRODUCT_MODULES = FannieConfig::config('PRODUCT_MODULES', array());
$upc = BarcodeLib::padUPC($upc);
- 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
Function saveFormData
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
function saveFormData($upc)
{
$FANNIE_PRODUCT_MODULES = FannieConfig::config('PRODUCT_MODULES', array());
$upc = BarcodeLib::padUPC($upc);
$dbc = $this->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 saveFormData
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
function saveFormData($upc)
{
$FANNIE_PRODUCT_MODULES = FannieConfig::config('PRODUCT_MODULES', array());
$upc = BarcodeLib::padUPC($upc);
$dbc = $this->db();
Method getNewItem
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getNewItem($upc)
{
$dbc = $this->db();
// default values for form fields
$rowItem = array(
Method getExistingItem
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getExistingItem($upc)
{
$dbc = $this->db();
$itemQ = '
SELECT
BaseItemModule
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class BaseItemModule extends \COREPOS\Fannie\API\item\ItemModule
{
private function getBarcodeType($upc)
{
$trimmed = ltrim($upc, '0');
Function getNewItem
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function getNewItem($upc)
{
$dbc = $this->db();
// default values for form fields
$rowItem = array(
- 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 deptMaps
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function deptMaps($rowItem, $range_limit)
{
$supers = array();
$depts = array();
$subs = array();
Method saveVendorItem
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function saveVendorItem($product, $vendorID)
{
$dbc = $this->db();
$upc = $product->upc();
/**
Function deptMaps
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function deptMaps($rowItem, $range_limit)
{
$supers = array();
$depts = array();
$subs = array();
- 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
Function summaryRows
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function summaryRows($upc)
{
$dbc = $this->db();
$model = new ProductsModel($dbc);
- 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 summaryRows
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function summaryRows($upc)
{
$dbc = $this->db();
$model = new ProductsModel($dbc);
Function saveVendorItem
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function saveVendorItem($product, $vendorID)
{
$dbc = $this->db();
$upc = $product->upc();
/**
- 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
Function getExistingItem
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getExistingItem($upc)
{
$dbc = $this->db();
$itemQ = '
SELECT
- 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
Function getBarcodeType
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getBarcodeType($upc)
{
$trimmed = ltrim($upc, '0');
$barcode_type = '';
if (strlen($trimmed) == '12') {
- 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"