File LikeCodeModule.php
has 359 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2013 Whole Foods Co-op, Duluth, MN
Method getFormJavascript
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFormJavascript($upc)
{
$FANNIE_URL = FannieConfig::config('URL');
ob_start();
?>
Method SaveFormData
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function SaveFormData($upc)
{
try {
$likecode = $this->form->likeCode;
} catch (Exception $ex) {
Function AjaxCallback
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function AjaxCallback()
{
$likecode = FormLib::get('lc',-1);
$newLC = FormLib::get('newLC', false);
$json = 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 AjaxCallback
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function AjaxCallback()
{
$likecode = FormLib::get('lc',-1);
$newLC = FormLib::get('newLC', false);
$json = array();
Function SaveFormData
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function SaveFormData($upc)
{
try {
$likecode = $this->form->likeCode;
} catch (Exception $ex) {
- 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 showEditForm
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function showEditForm($upc, $display_mode=1, $expand_mode=1)
{
$dbc = $this->db();
$myLC = $this->getLikeCode($dbc, $upc);
$ret = '<div id="LikeCodeFieldSet" class="panel panel-default">';
Method LikeCodeItems
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function LikeCodeItems($likecode, $upc='nomatch')
{
if ($likecode == -1) return '';
$ret = "<b>Like Code Linked Items</b><div id=lctable>";
$ret .= "<table class=\"alert alert-warning table\">";
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return true;
Function showEditForm
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function showEditForm($upc, $display_mode=1, $expand_mode=1)
{
$dbc = $this->db();
$myLC = $this->getLikeCode($dbc, $upc);
$ret = '<div id="LikeCodeFieldSet" class="panel panel-default">';
- 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"