Code Duplication    Length = 23-25 lines in 3 locations

htdocs/modules/comments/class/plugin/waiting.php 1 location

@@ 22-44 (lines=23) @@
19
 * @author          trabis <[email protected]>
20
 * @version         $Id$
21
 */
22
class CommentsWaitingPlugin implements WaitingPluginInterface
23
{
24
25
    /**
26
     * @return array
27
     */
28
    public function waiting()
29
    {
30
        /* @var $comments Comments */
31
        $comments = \Xoops::getModuleHelper('comments'); //need this here to init constants
32
        $criteria = new CriteriaCompo(new Criteria('status', Comments::STATUS_PENDING));
33
        $ret = array();
34
        if ($count = $comments->getHandlerComment()->getCount($criteria)) {
35
            $ret[] = [
36
                'count' => $count,
37
                'name' => $comments->getModule()->getVar('name'),
38
                'link' => $comments->url('admin/main.php')
39
            ];
40
        }
41
        return $ret;
42
    }
43
44
}

htdocs/modules/page/class/plugin/waiting.php 1 location

@@ 17-41 (lines=25) @@
14
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
15
 * @author          trabis <[email protected]>
16
 */
17
class PageWaitingPlugin implements WaitingPluginInterface
18
{
19
    /**
20
     * @return array
21
     */
22
    public function waiting()
23
    {
24
        $ret = array();
25
26
        /* @var $page Page */
27
        $page = \Xoops::getModuleHelper('page');
28
29
        $criteria = new CriteriaCompo(new Criteria('content_status', 0));
30
31
        if ($count = $page->getContentHandler()->getCount($criteria)) {
32
            $ret[] = [
33
                'count' => $count,
34
                'name' => $page->getModule()->getVar('name'),
35
                'link' => $page->url('admin/content.php')
36
            ];
37
        }
38
39
        return $ret;
40
    }
41
}

htdocs/modules/publisher/class/plugin/waiting.php 1 location

@@ 18-40 (lines=23) @@
15
 * @author          trabis <[email protected]>
16
 * @author          Laurent JEN (aka DuGris)
17
 */
18
class PublisherWaitingPlugin implements WaitingPluginInterface
19
{
20
21
    /**
22
     * @return array
23
     */
24
    public function waiting()
25
    {
26
        $publisher = Publisher::getInstance();
27
        $ret = array();
28
        $criteria = new CriteriaCompo();
29
        $criteria->add(new Criteria('status', 1));
30
        $count = $publisher->getItemHandler()->getCount($criteria);
31
        if ($count) {
32
            $ret[] = [
33
                'count' => $count,
34
                'name' => _MI_PUBLISHER_WAITING,
35
                'link' => $publisher->url('admin/item.php')
36
            ];
37
        }
38
        return $ret;
39
    }
40
}
41