File Database.php
has 509 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2012 Whole Foods Co-op
Database
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class Database
{
/***********************************************************************************************
Method getsubtotals
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
static public function getsubtotals()
{
$query = "SELECT * FROM subtotals";
$connection = self::tDataConnect();
$result = $connection->query($query);
Method uploadtoServer
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
static private function uploadtoServer()
{
$uploaded = 0;
CoreLocal::set("standalone",1);
Method lineItemTaxes
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
static public function lineItemTaxes()
{
$dbc = self::tDataConnect();
$taxQ = "SELECT id, description, taxTotal, fsTaxable, fsTaxTotal, foodstampTender, taxrate
FROM taxView ORDER BY taxrate DESC";
Method getMatchingColumns
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
static public function getMatchingColumns($connection,$tableName,$table2="")
{
/**
Cache column information by table in the session
In standalone mode, a transfer query likely failed
Function getsubtotals
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
static public function getsubtotals()
{
$query = "SELECT * FROM subtotals";
$connection = self::tDataConnect();
$result = $connection->query($query);
- 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 uploadCCdata
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
static private function uploadCCdata()
{
if (!in_array("Paycards",CoreLocal::get("PluginList"))) {
// plugin not enabled; nothing to upload
return true;
Function lineItemTaxes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
static public function lineItemTaxes()
{
$dbc = self::tDataConnect();
$taxQ = "SELECT id, description, taxTotal, fsTaxable, fsTaxTotal, foodstampTender, taxrate
FROM taxView ORDER BY taxrate DESC";
- 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 getMatchingColumns
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
static public function getMatchingColumns($connection,$tableName,$table2="")
{
/**
Cache column information by table in the session
In standalone mode, a transfer query likely failed
- 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 getLocalConnection
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
static private function getLocalConnection($database1, $database2)
{
if (self::$SQL_CONNECTION === null){
/**
Add both local databases to the connection object
- 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 uploadCCdata
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
static private function uploadCCdata()
{
if (!in_array("Paycards",CoreLocal::get("PluginList"))) {
// plugin not enabled; nothing to upload
return 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 uploadtoServer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static private function uploadtoServer()
{
$uploaded = 0;
CoreLocal::set("standalone",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
Function loadglobalvalue
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static private function loadglobalvalue($param,$val)
{
switch (strtoupper($param)) {
case 'CASHIERNO':
CoreLocal::set("CashierNo",$val);
- 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;
Function gettransno
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static public function gettransno($cashierNo)
{
$connection = self::tDataConnect();
$registerNo = CoreLocal::get("laneno");
$query = "SELECT max(trans_no) as maxtransno from localtranstoday where emp_no = "
- 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"