File ItemEditorPage.php
has 765 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2013 Whole Foods Community Co-op
Function getConfiguredModules
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
private function getConfiguredModules()
{
$FANNIE_PRODUCT_MODULES = $this->config->get('PRODUCT_MODULES');
if (!is_array($FANNIE_PRODUCT_MODULES)) {
$FANNIE_PRODUCT_MODULES = array('BaseItemModule' => array('seq'=>0, 'show'=>1, 'expand'=>1));
- 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 editForm
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function editForm($upc,$isNew)
{
$FANNIE_PRODUCT_MODULES = $this->getConfiguredModules();
$FANNIE_URL = $this->config->get('URL');
$shown = array();
Method searchForm
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function searchForm()
{
$FANNIE_URL = $this->config->get('URL');
$ret = '';
$vars = array(
Method searchResults
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function searchResults()
{
$authorized = false;
if (FannieAuth::validateUserQuiet('admin')) {
$authorized = true;
Method javascript_content
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function javascript_content()
{
return <<<JAVASCRIPT
$(document).ready(function(){
alterTable();
Function editForm
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function editForm($upc,$isNew)
{
$FANNIE_PRODUCT_MODULES = $this->getConfiguredModules();
$FANNIE_URL = $this->config->get('URL');
$shown = 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 searchResults
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function searchResults()
{
$authorized = false;
if (FannieAuth::validateUserQuiet('admin')) {
$authorized = true;
- 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 searchQuery
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function searchQuery($upc, $numType, $inUseFlag, $store_id)
{
$query = '';
$args = array();
if (is_numeric($upc)) {
Method editorLinksArea
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function editorLinksArea($upc, $isNew, $authorized)
{
$url = $this->config->get('URL');
$self = filter_input(INPUT_SERVER, 'PHP_SELF');
$ret = '<p>';
Method helpContent
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function helpContent()
{
$ret = '<p>This tool is for adding or editing an item</p>';
if ($this->mode == 'search') {
$ret .= '<p>
Method saveItem
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function saveItem($isNew)
{
$FANNIE_PRODUCT_MODULES = $this->getConfiguredModules();
$FANNIE_URL = $this->config->get('URL');
Method getConfiguredModules
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getConfiguredModules()
{
$FANNIE_PRODUCT_MODULES = $this->config->get('PRODUCT_MODULES');
if (!is_array($FANNIE_PRODUCT_MODULES)) {
$FANNIE_PRODUCT_MODULES = array('BaseItemModule' => array('seq'=>0, 'show'=>1, 'expand'=>1));
Function searchQuery
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function searchQuery($upc, $numType, $inUseFlag, $store_id)
{
$query = '';
$args = array();
if (is_numeric($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 saveItem
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function saveItem($isNew)
{
$FANNIE_PRODUCT_MODULES = $this->getConfiguredModules();
$FANNIE_URL = $this->config->get('URL');
- 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 multipleResults
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function multipleResults($results)
{
$FANNIE_URL = $this->config->get('URL');
$ret = '<table id="itemSearchResults" class="tablesorter">';
$ret .= '<thead><tr>
Function userCanEdit
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function userCanEdit($upc, $isNew)
{
$authorized = false;
if (FannieAuth::validateUserQuiet('pricechange') || FannieAuth::validateUserQuiet('audited_pricechange')) {
$authorized = true;
- 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 readinessCheck
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function readinessCheck()
{
if ($this->config->get('STORE_MODE') != 'HQ') {
return true;
} else {
- 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
Avoid too many return
statements within this method. Open
return $this->editForm($actualUPC, $this->mode === 'new' ? true : false);
Avoid too many return
statements within this method. Open
return $this->multipleResults($items);
Avoid too many return
statements within this method. Open
return true;
Function helpContent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function helpContent()
{
$ret = '<p>This tool is for adding or editing an item</p>';
if ($this->mode == 'search') {
$ret .= '<p>
- 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 preprocess
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function preprocess()
{
$mods = $this->getConfiguredModules();
$this->title = _('Fannie') . ' - ' . _('Item Maintenance');
- 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"