Completed
Push — master ( 58c169...669900 )
by Michael
02:06
created

yomi.php ➔ b_waiting_yomi()   B

Complexity

Conditions 3
Paths 4

Size

Total Lines 24
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 1
Metric Value
cc 3
eloc 16
c 4
b 0
f 1
nc 4
nop 0
dl 0
loc 24
rs 8.9713
1
<?php
2
/**
3
 * @return array
4
 */
5
function b_waiting_yomi()
6
{
7
    $log_path      = XOOPS_ROOT_PATH . '/modules/yomi/log/';
8
    $log_file      = 'ys4_temp.cgi';
9
    $lang_linkname = 'Yomi';
0 ignored issues
show
Unused Code introduced by
$lang_linkname is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
10
    $block         = array();
11
    $cTemp         = 0;
12
    $fp            = fopen("{$log_path}{$log_file}", 'r');
13
14
    while ($tmp = fgets($fp, 4096)) {
0 ignored issues
show
Unused Code introduced by
$tmp is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
15
        ++$cTemp;
16
    }
17
    fclose($fp);
18
19
    if (0 !== $cTemp) {
20
        $block = array(
21
            'adminlink'     => XOOPS_URL . '/modules/yomi/admin.php',
22
            'pendingnum'    => $cTemp,
23
            'lang_linkname' => _PI_WAITING_WAITINGS
24
        );
25
    }
26
27
    return $block;
28
}
29