File DTrans.php
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/*******************************************************************************
Copyright 2013 Whole Foods Co-op
Function addItem
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public static function addItem(SQLManager $connection, $trans_no, $params)
{
$config = FannieConfig::factory();
$model = new DTransactionsModel($connection);
$model->whichDB($config->get('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
DTrans
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class DTrans
{
/**
Array of default values for dtransaction-style tables
Method addItem
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function addItem(SQLManager $connection, $trans_no, $params)
{
$config = FannieConfig::factory();
$model = new DTransactionsModel($connection);
$model->whichDB($config->get('TRANS_DB'));
Function getTransNo
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function getTransNo(SQLManager $connection, $emp_no=false, $register_no=false)
{
$config = FannieConfig::factory();
if ($emp_no === false) {
$emp_no = $config->get('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"
Further reading
Method departmentClause
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function departmentClause($deptStart, $deptEnd, $deptMulti, $args, $alias='d')
Method addOpenRing
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function addOpenRing(SQLManager $connection, $department, $amount, $trans_no, $params=array())
Function parameterize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function parameterize($arr, $datecol='', $datefunc='')
{
$columns = !empty($datecol) && !empty($datefunc) ? $datecol.',' : '';
$values = !empty($datecol) && !empty($datefunc) ? $datefunc.',' : '';
$args = 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"