b_wflinks_banner_edit()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Module: WF-links
4
 * Developer: McDonald
5
 * Licence: GNU
6
 * @param mixed $options
7
 */
8
9
/**
10
 * @param $options
11
 *
12
 * @return array
13
 */
14
function b_wflinks_banner_show($options)
0 ignored issues
show
Unused Code introduced by
The parameter $options is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

14
function b_wflinks_banner_show(/** @scrutinizer ignore-unused */ $options)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
15
{
16
    $moduleDirName = basename(__DIR__);
17
    global $xoopsDB;
18
19
    $block = [];
20
    $time  = time();
0 ignored issues
show
Unused Code introduced by
The assignment to $time is dead and can be removed.
Loading history...
21
    /** @var \XoopsModuleHandler $moduleHandler */
22
    $moduleHandler = xoops_getHandler('module');
23
    $wflModule     = $moduleHandler->getByDirname($moduleDirName);
24
25
    $result = $xoopsDB->query(
26
        'SELECT a.cid AS acid, a.title, a.client_id, a.banner_id, b.bid, b.cid, b.imptotal, b.impmade, b.clicks FROM ' . $xoopsDB->prefix('wflinks_cat') . ' a, ' . $xoopsDB->prefix('banner') . ' b WHERE (b.cid = a.client_id) OR (b.bid = a.banner_id) ORDER BY b.cid, b.bid, a.title ASC'
27
    );
28
29
    while (false !== ($myrow = $xoopsDB->fetchArray($result))) {
30
        $impmade    = $myrow['impmade'];
31
        $clicks     = $myrow['clicks'];
32
        $imptotal   = $myrow['imptotal'];
33
        $bannerload = [];
34
        $result2    = $xoopsDB->query('SELECT name FROM ' . $xoopsDB->prefix('bannerclient') . ' WHERE cid=' . (int)$myrow['cid']);
35
        $myclient   = $xoopsDB->fetchArray($result2);
36
        if (0 == $impmade) {
37
            $percent = 0;
38
        } else {
39
            $percent = mb_substr(100 * $clicks / $impmade, 0, 5);
40
        }
41
        if (0 == $imptotal) {
42
            $left = 'Unlimited';
43
        } else {
44
            $left = ($imptotal - $impmade);
45
        }
46
        $bannerload['cat']      = (int)$myrow['acid'];
47
        $bannerload['bid']      = (int)$myrow['bid'];
48
        $bannerload['cid']      = (int)$myrow['cid'];
49
        $bannerload['imptotal'] = (int)$myrow['imptotal'];
50
        $bannerload['impmade']  = (int)$myrow['impmade'];
51
        $bannerload['impleft']  = $left;
52
        $bannerload['clicks']   = (int)$myrow['clicks'];
53
        $bannerload['client']   = $myclient['name'];
54
        $bannerload['percent']  = $percent;
55
        $bannerload['cattitle'] = $myrow['title'];
56
        $bannerload['dirname']  = $wflModule->getVar('dirname');
57
        $block['banners'][]     = $bannerload;
58
    }
59
    unset($_block_check_array);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $_block_check_array seems to be never defined.
Loading history...
60
61
    return $block;
62
}
63
64
/**
65
 * @param $options
66
 *
67
 * @return string
68
 */
69
function b_wflinks_banner_edit($options)
0 ignored issues
show
Unused Code introduced by
The parameter $options is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

69
function b_wflinks_banner_edit(/** @scrutinizer ignore-unused */ $options)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
70
{
71
    $form = '';
72
73
    return $form;
74
}
75