Conditions | 3 |
Paths | 4 |
Total Lines | 27 |
Lines | 10 |
Ratio | 37.04 % |
Changes | 0 |
1 | <?php |
||
20 | function b_waiting_presenter() |
||
21 | { |
||
22 | $db = XoopsDatabaseFactory::getDatabaseConnection(); |
||
23 | $ret = []; |
||
24 | |||
25 | // waiting categories |
||
26 | $block = []; |
||
27 | $result = $db->query('SELECT COUNT(*) FROM ' . $db->prefix('presenter_categories') . ' WHERE cat_waiting = 1'); |
||
28 | View Code Duplication | if ($result) { |
|
|
|||
29 | $block['adminlink'] = XOOPS_URL . '/modules/presenter/admin/categories.php?op=list_waiting'; |
||
30 | list($block['pendingnum']) = $db->fetchRow($result); |
||
31 | $block['lang_linkname'] = _MB_PRESENTER_CATEGORIES_WAITING; |
||
32 | } |
||
33 | $ret[] = $block; |
||
34 | |||
35 | // waiting slides |
||
36 | $block = []; |
||
37 | $result = $db->query('SELECT COUNT(*) FROM ' . $db->prefix('presenter_slides') . ' WHERE slides_waiting = 1'); |
||
38 | View Code Duplication | if ($result) { |
|
39 | $block['adminlink'] = XOOPS_URL . '/modules/presenter/admin/slides.php?op=list_waiting'; |
||
40 | list($block['pendingnum']) = $db->fetchRow($result); |
||
41 | $block['lang_linkname'] = _MB_PRESENTER_SLIDES_WAITING; |
||
42 | } |
||
43 | $ret[] = $block; |
||
44 | |||
45 | return $ret; |
||
46 | } |
||
47 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.