Code Duplication    Length = 26-26 lines in 3 locations

blocks/day_events.php 1 location

@@ 27-52 (lines=26) @@
24
 *
25
 * @return mixed
26
 */
27
function bExtcalDayShow($options)
28
{
29
    require_once __DIR__ . '/../class/config.php';
30
31
    // Retriving module config
32
    $extcalConfig      = ExtcalConfig::getHandler();
33
    $xoopsModuleConfig = $extcalConfig->getModuleConfig();
34
35
    $eventHandler = xoops_getModuleHandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE);
36
37
    $nbEvent     = $options[0];
38
    $titleLenght = $options[1];
39
    array_shift($options);
40
    array_shift($options);
41
42
    // Checking if no cat is selected
43
    if (0 == $options[0] && 1 == count($options)) {
44
        $options = 0;
45
    }
46
47
    $events = $eventHandler->objectToArray($eventHandler->getThisDayEvent($nbEvent, $options));
48
    $eventHandler->serverTimeToUserTimes($events);
49
    $eventHandler->formatEventsDate($events, $xoopsModuleConfig['event_date_month']);
50
51
    return $events;
52
}
53
54
/**
55
 * @param $options

blocks/new_events.php 1 location

@@ 27-52 (lines=26) @@
24
 *
25
 * @return mixed
26
 */
27
function bExtcalNewShow($options)
28
{
29
    require_once __DIR__ . '/../class/config.php';
30
31
    // Retriving module config
32
    $extcalConfig      = ExtcalConfig::getHandler();
33
    $xoopsModuleConfig = $extcalConfig->getModuleConfig();
34
35
    $eventHandler = xoops_getModuleHandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE);
36
37
    $nbEvent     = $options[0];
38
    $titleLenght = $options[1];
39
    array_shift($options);
40
    array_shift($options);
41
42
    // Checking if no cat is selected
43
    if (0 == $options[0] && 1 == count($options)) {
44
        $options = 0;
45
    }
46
47
    $events = $eventHandler->objectToArray($eventHandler->getNewEvent(0, $nbEvent, $options));
48
    $eventHandler->serverTimeToUserTimes($events);
49
    $eventHandler->formatEventsDate($events, $xoopsModuleConfig['event_date_month']);
50
51
    return $events;
52
}
53
54
/**
55
 * @param $options

blocks/random_events.php 1 location

@@ 27-52 (lines=26) @@
24
 *
25
 * @return mixed
26
 */
27
function bExtcalRandomShow($options)
28
{
29
    require_once __DIR__ . '/../class/config.php';
30
31
    // Retriving module config
32
    $extcalConfig      = ExtcalConfig::getHandler();
33
    $xoopsModuleConfig = $extcalConfig->getModuleConfig();
34
35
    $eventHandler = xoops_getModuleHandler(_EXTCAL_CLS_EVENT, _EXTCAL_MODULE);
36
37
    $nbEvent     = $options[0];
38
    $titleLenght = $options[1];
39
    array_shift($options);
40
    array_shift($options);
41
42
    // Checking if no cat is selected
43
    if (0 == $options[0] && 1 == count($options)) {
44
        $options = 0;
45
    }
46
47
    $events = $eventHandler->objectToArray($eventHandler->getRandomEvent($nbEvent, $options));
48
    $eventHandler->serverTimeToUserTimes($events);
49
    $eventHandler->formatEventsDate($events, $xoopsModuleConfig['event_date_month']);
50
51
    return $events;
52
}
53
54
/**
55
 * @param $options