Code Duplication    Length = 30-30 lines in 3 locations

blocks/category.php 1 location

@@ 33-62 (lines=30) @@
30
 *
31
 * @return array
32
 */
33
function showRandomquoteCategory($options)
34
{
35
    // require_once dirname(__DIR__) . '/class/category.php';
36
    $moduleDirName = basename(dirname(__DIR__));
37
    //$myts = \MyTextSanitizer::getInstance();
38
39
    $block         = [];
40
    $blockType     = $options[0];
41
    $categoryCount = $options[1];
42
    //$titleLenght = $options[2];
43
44
    /** @var XoopsObjectHandler $categoryHandler */
45
    $categoryHandler = new randomquote\CategoryHandler($GLOBALS['xoopsDB']);
46
    $criteria        = new CriteriaCompo();
47
    array_shift($options);
48
    array_shift($options);
49
    array_shift($options);
50
    if ($blockType) {
51
        $criteria->add(new Criteria('id', 0, '!='));
52
        $criteria->setSort('id');
53
        $criteria->setOrder('ASC');
54
    }
55
56
    $criteria->setLimit($categoryCount);
57
    $categoryArray = $categoryHandler->getAll($criteria);
58
    foreach (array_keys($categoryArray) as $i) {
59
    }
60
61
    return $block;
62
}
63
64
/**
65
 * @param $options

blocks/quotes - Copy.php 1 location

@@ 33-62 (lines=30) @@
30
 *
31
 * @return array
32
 */
33
function showRandomquoteQuotes($options)
34
{
35
    // require_once dirname(__DIR__) . '/class/quotes.php';
36
    $moduleDirName = basename(dirname(__DIR__));
37
    //$myts = \MyTextSanitizer::getInstance();
38
39
    $block       = [];
40
    $blockType   = $options[0];
41
    $quotesCount = $options[1];
42
    //$titleLenght = $options[2];
43
44
    /** @var XoopsObjectHandler $quotesHandler */
45
    $quotesHandler = new randomquote\QuotesHandler($GLOBALS['xoopsDB']); // xoops_getModuleHandler('quotes', $moduleDirName);
46
    $criteria      = new CriteriaCompo();
47
    array_shift($options);
48
    array_shift($options);
49
    array_shift($options);
50
    if ($blockType) {
51
        $criteria->add(new Criteria('id', 0, '!='));
52
        $criteria->setSort('id');
53
        $criteria->setOrder('ASC');
54
    }
55
56
    $criteria->setLimit($quotesCount);
57
    $quotesArray = $quotesHandler->getAll($criteria);
58
    foreach (array_keys($quotesArray) as $i) {
59
    }
60
61
    return $block;
62
}
63
64
/**
65
 * @param $options

blocks/quotes.php 1 location

@@ 33-62 (lines=30) @@
30
 *
31
 * @return array
32
 */
33
function showRandomquoteQuotes($options)
34
{
35
    // require_once dirname(__DIR__) . '/class/quotes.php';
36
    $moduleDirName = basename(dirname(__DIR__));
37
    //$myts = \MyTextSanitizer::getInstance();
38
39
    $block       = [];
40
    $blockType   = $options[0];
41
    $quotesCount = $options[1];
42
    //$titleLenght = $options[2];
43
44
    /** @var XoopsObjectHandler $quotesHandler */
45
    $quotesHandler = new randomquote\QuotesHandler($GLOBALS['xoopsDB']);
46
    $criteria      = new CriteriaCompo();
47
    array_shift($options);
48
    array_shift($options);
49
    array_shift($options);
50
    if ($blockType) {
51
        $criteria->add(new Criteria('id', 0, '!='));
52
        $criteria->setSort('id');
53
        $criteria->setOrder('ASC');
54
    }
55
56
    $criteria->setLimit($quotesCount);
57
    $quotesArray = $quotesHandler->getAll($criteria);
58
    foreach (array_keys($quotesArray) as $i) {
59
    }
60
61
    return $block;
62
}
63
64
/**
65
 * @param $options