Showing 1,089 of 1,089 total issues
Function updateWorkers
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function updateWorkers($account_id, $data) {
$this->debug->append("STA " . __METHOD__, 4);
if (!is_array($data)) {
$this->setErrorMessage('No workers to update');
return false;
- 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 setHeaders
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function setHeaders(Swift_Mime_HeaderSet $headers)
{
$this->_headerCanonData = '';
// Loop through Headers
$listHeaders = $headers->listAll();
- 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 setHeaders
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function setHeaders(Swift_Mime_HeaderSet $headers)
{
$this->_startHash();
$this->_canonData = '';
// Loop through Headers
- 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 smarty_modifier_relative_date
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function smarty_modifier_relative_date($timestamp, $days = false, $format = "M j, Y") {
if (!is_numeric($timestamp)) {
// It's not a time stamp, so try to convert it...
$timestamp = strtotime($timestamp);
Method smarty_function_html_radios_output
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape)
{
$_output = '';
if (is_object($value)) {
Method smarty_function_cycle
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function smarty_function_cycle($params, $template)
{
static $cycle_vars;
$name = (empty($params['name'])) ? 'default' : $params['name'];
Method compile
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function compile($args, $compiler, $parameter)
{
// the following must be assigned at runtime because it will be overwritten in Smarty_Internal_Compile_Append
$this->required_attributes = array('var', 'value');
$this->shorttag_order = array('var', 'value');
Method yylex4
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function yylex4()
{
$tokenMap = array (
1 => 0,
2 => 0,
Method _canonicalizeBody
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _canonicalizeBody($string)
{
$len = strlen($string);
$canon = '';
$method = ($this->_bodyCanon == "relaxed");
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (!is_array($function)) {
$output = "{$function}({$params})";
} else {
if (is_object($function[0])) {
$output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')';
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 118.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (!is_array($function)) {
$output = "{$function}({$params})";
} else {
if (is_object($function[0])) {
$output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')';
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 118.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method compileAllTemplates
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function compileAllTemplates($extension, $force_compile, $time_limit, $max_errors, Smarty $smarty)
{
// switch off time limit
if (function_exists('set_time_limit')) {
@set_time_limit($time_limit);
Method createTemplate
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true)
{
if (!empty($cache_id) && (is_object($cache_id) || is_array($cache_id))) {
$parent = $cache_id;
$cache_id = null;
Method append
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function append($tpl_var, $value = null, $merge = false, $nocache = false)
{
if (is_array($tpl_var)) {
// $tpl_var is an array, ignore $value
foreach ($tpl_var as $_key => $_val) {
Method yylex6
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function yylex6()
{
$tokenMap = array (
1 => 0,
2 => 0,
Method getTransactionTypebyTime
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getTransactionTypebyTime($account_id=NULL) {
$this->debug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__)) return $data;
$stmt = $this->mysqli->prepare("
SELECT
Method yylex5
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function yylex5()
{
$tokenMap = array (
1 => 0,
2 => 0,
Method compile
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function compile($args, $compiler)
{
if (!($compiler->smarty instanceof SmartyBC)) {
throw new SmartyException("{include_php} is deprecated, use SmartyBC class to enable");
}
Method setChildren
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setChildren(array $children, $compoundLevel = null)
{
// TODO: Try to refactor this logic
$compoundLevel = isset($compoundLevel)
Method parseSpan
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function parseSpan($str) {
#
# Take the string $str and parse it into tokens, hashing embeded HTML,
# escaped characters and handling code spans.
#