File ProductListPage.php
has 575 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2013 Whole Foods Co-op
Function list_content
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
private function list_content()
{
global $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_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 list_content
has 174 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function list_content()
{
global $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_OP_DB);
Method form_content
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function form_content()
{
global $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_OP_DB);
Method javascript_content
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function javascript_content()
{
global $FANNIE_OP_DB;
if ($this->excel) return '';
Method rowToTable
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function rowToTable($row, $multi)
{
$ret = '<tr id="'.$row[0].'">';
$enc = base64_encode($row[1]);
if (!$this->excel) {
Function javascript_content
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function javascript_content()
{
global $FANNIE_OP_DB;
if ($this->excel) return '';
- 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 ajax_response
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function ajax_response()
{
global $FANNIE_OP_DB;
$dbc = FannieDB::get($FANNIE_OP_DB);
switch(FormLib::get('ajax')){
Method saveItem
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function saveItem($dbc, $upc, $store_id, $form)
{
$model = new ProductsModel($dbc);
$model->upc($upc);
$model->store_id($store_id);
Function rowToTable
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function rowToTable($row, $multi)
{
$ret = '<tr id="'.$row[0].'">';
$enc = base64_encode($row[1]);
if (!$this->excel) {
- 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 saveItem
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function saveItem($dbc, $upc, $store_id, $form)
{
$model = new ProductsModel($dbc);
$model->upc($upc);
$model->store_id($store_id);
- 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"