Showing 889 of 1,089 total issues
Method doDefLists
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function doDefLists($text) {
#
# Form HTML definition lists.
#
$less_than_tab = $this->tab_width - 1;
Method encodeString
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
{
if ($maxLineLength > 76 || $maxLineLength <= 0) {
$maxLineLength = 76;
}
Method _appendFootnotes_callback
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function _appendFootnotes_callback($matches) {
$node_id = $this->fn_id_prefix . $matches[1];
# Create footnote marker only if it has a corresponding footnote *and*
# the footnote hasn't been used by another marker.
Consider simplifying this complex logical expression. Open
Open
if ((!isset($_compile_id) || (isset($_filepath[$_compile_id_part_length]) && !strncmp($_filepath, $_compile_id_part, $_compile_id_part_length)))
&& (!isset($resource_name)
|| (isset($_filepath[$_resource_part_1_length])
&& substr_compare($_filepath, $_resource_part_1, -$_resource_part_1_length, $_resource_part_1_length) == 0)
|| (isset($_filepath[$_resource_part_2_length])
Consider simplifying this complex logical expression. Open
Open
if ($this->properties['version'] != Smarty::SMARTY_VERSION) {
$is_valid = false;
} elseif (((!$cache && $this->smarty->compile_check && empty($this->compiled->_properties) && !$this->compiled->isCompiled) || $cache && ($this->smarty->compile_check === true || $this->smarty->compile_check === Smarty::COMPILECHECK_ON)) && !empty($this->properties['file_dependency'])) {
foreach ($this->properties['file_dependency'] as $_file_to_check) {
if ($_file_to_check[2] == 'file' || $_file_to_check[2] == 'php') {
Consider simplifying this complex logical expression. Open
Open
if ($config['twofactor']['enabled'] && $user->isAuthenticated()) {
// set the token to be the old token, just in case an error occured
$ea_token = (@$oldtoken_ea !== '') ? $oldtoken_ea : @$ea_token;
$wf_token = (@$oldtoken_wf !== '') ? $oldtoken_wf : @$wf_token;
$cp_token = (@$oldtoken_cp !== '') ? $oldtoken_cp : @$cp_token;
Method getPluginFromDefaultHandler
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getPluginFromDefaultHandler($tag, $plugin_type)
{
$callback = null;
$script = null;
$cacheable = true;
Method populate
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)
{
$_source_file_path = str_replace(':', '.', $_template->source->filepath);
$_cache_id = isset($_template->cache_id) ? preg_replace('![^\w\|]+!', '_', $_template->cache_id) : null;
$_compile_id = isset($_template->compile_id) ? preg_replace('![^\w\|]+!', '_', $_template->compile_id) : null;
Method compile
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function compile($args, $compiler, $parameter, $tag, $function)
{
if (!isset($tag[5]) || substr($tag, -5) != 'close') {
// opening tag of block plugin
// check and get attributes
Method compile
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function compile($args, $compiler, $parameter, $tag)
{
// This tag does create output
$compiler->has_output = true;
// check and get attributes
Method getAllIdleWorkers
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getAllIdleWorkers($interval=600) {
$this->debug->append("STA " . __METHOD__, 4);
$stmt = $this->mysqli->prepare("
SELECT w.account_id AS account_id, w.id AS id, w.username AS username
FROM
Method createDebitRecord
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function createDebitRecord($account_id, $coin_address, $amount, $type) {
// Calculate and deduct txfee from amount
$type == 'Debit_MP' ? $txfee = $this->config['txfee_manual'] : $txfee = $this->config['txfee_auto'];
$amount = $amount - $txfee;
// Add Debit record
Method processDefListItems
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function processDefListItems($list_str) {
#
# Process the contents of a single definition list, splitting it
# into individual term and definition list items.
#
Method getTemplateVars
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getTemplateVars($varname = null, $_ptr = null, $search_parents = true)
{
if (isset($varname)) {
$_var = $this->getVariable($varname, $_ptr, $search_parents, false);
if (is_object($_var)) {
Method compile
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function compile($args, $compiler)
{
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
if ($_attr['nocache'] === true) {
Method yy_r154
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function yy_r154(){
if (!$this->security || $this->smarty->security_policy->isTrustedPhpFunction($this->yystack[$this->yyidx + -3]->minor, $this->compiler)) {
if (strcasecmp($this->yystack[$this->yyidx + -3]->minor,'isset') === 0 || strcasecmp($this->yystack[$this->yyidx + -3]->minor,'empty') === 0 || strcasecmp($this->yystack[$this->yyidx + -3]->minor,'array') === 0 || is_callable($this->yystack[$this->yyidx + -3]->minor)) {
$func_name = strtolower($this->yystack[$this->yyidx + -3]->minor);
if ($func_name == 'isset') {
Method getUserEstimates
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function getUserEstimates($value1, $value2, $dDonate, $bNoFees, $ppsvalue=0) {
$this->debug->append("STA " . __METHOD__, 4);
if ($this->config['payout_system'] != 'pps') {
if (@$value1['valid'] > 0 && @$value2['valid'] > 0) {
$this->config['reward_type'] == 'fixed' ? $reward = $this->config['reward'] : $reward = $this->block->getAverageAmount();
Method sendNotification
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function sendNotification($account_id, $strType, $aMailData) {
// Check if we notified for this event already
if ( $this->isNotified($aMailData) ) {
$this->setErrorMessage('A notification for this event has been sent already');
return false;
Method flushQueue
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function flushQueue(Swift_Transport $transport, &$failedRecipients = null)
{
$directoryIterator = new DirectoryIterator($this->_path);
/* Start the transport only if there are queued files to send */
Function addAutoloadFilters
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
public function addAutoloadFilters($filters, $type=null)
{
if ($type !== null) {
if (!empty($this->autoload_filters[$type])) {
$this->autoload_filters[$type] = array_merge($this->autoload_filters[$type], (array) $filters);
- 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"