File ProgramEventsReport.php
has 377 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2013 Whole Foods Co-op
Copyright 2014 West End Food Co-op, Toronto
Method fetch_report_data
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fetch_report_data(){
global $FANNIE_ARCHIVE_METHOD, $FANNIE_ARCHIVE_DB,
$FANNIE_OP_DB, $FANNIE_TRANS_DB;
Method form_content
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
function form_content(){
global $FANNIE_PLUGIN_SETTINGS;
$dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['CoopCredDatabase']);
Function preprocess
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function preprocess(){
global $FANNIE_URL,$FANNIE_PLUGIN_LIST,$FANNIE_PLUGIN_SETTINGS;
if (!isset($FANNIE_PLUGIN_LIST) || !in_array('CoopCred', $FANNIE_PLUGIN_LIST)) {
$this->errors[] = "The Coop Cred plugin is not enabled.";
- 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 fetch_report_data
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function fetch_report_data(){
global $FANNIE_ARCHIVE_METHOD, $FANNIE_ARCHIVE_DB,
$FANNIE_OP_DB, $FANNIE_TRANS_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 preprocess
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
function preprocess(){
global $FANNIE_URL,$FANNIE_PLUGIN_LIST,$FANNIE_PLUGIN_SETTINGS;
if (!isset($FANNIE_PLUGIN_LIST) || !in_array('CoopCred', $FANNIE_PLUGIN_LIST)) {
$this->errors[] = "The Coop Cred plugin is not enabled.";
Function form_content
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function form_content(){
global $FANNIE_PLUGIN_SETTINGS;
$dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['CoopCredDatabase']);
- 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 True;
Avoid too many return
statements within this method. Open
return True;
Function calculate_footers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function calculate_footers($data){
$sumProgram = 0.0;
if ($this->sortable) {
foreach($data as $row){
$sumProgram += $row[5];
- 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"