Passed
Push — master ( d2520f...3f8ec2 )
by Michael
02:50
created

bExtcalMinicalShow()   F

Complexity

Conditions 13
Paths 576

Size

Total Lines 215
Code Lines 115

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 215
rs 2.605
c 0
b 0
f 0
cc 13
eloc 115
nc 576
nop 1

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 32 and the first side effect is on line 22.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/*
3
 * You may not change or alter any portion of this comment or credits
4
 * of supporting developers from this source code or any supporting source code
5
 * which is considered copyrighted (c) material of the original comment or credit authors.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 */
11
12
/**
13
 * @copyright    {@link https://xoops.org/ XOOPS Project}
14
 * @license      {@link http://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
15
 * @package      extcal
16
 * @since
17
 * @author       XOOPS Development Team,
18
 */
19
20
use XoopsModules\Extcal;
21
22
global $extcalConfig, $xoopsUser;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
23
require_once __DIR__ . '/../include/constantes.php';
24
// require_once __DIR__ . '/../class/Utility.php';
0 ignored issues
show
Unused Code Comprehensibility introduced by
39% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
25
// require_once __DIR__ . '/../class/tableForm.php';
26
//---------------------------------------------------------------------------
27
/**
28
 * @param $options
29
 *
30
 * @return array
31
 */
32
function bExtcalMinicalShow($options)
33
{
34
    global $extcalConfig, $xoopsUser;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
35
36
    extcal_getDefautminicalOption($options);
37
38
    //    // require_once __DIR__ . '/../class/config.php';
39
40
    require_once _EXTCAL_PEAR_CALENDAR_ROOT . '/Util/Textual.php';
41
    require_once _EXTCAL_PEAR_CALENDAR_ROOT . '/Month/Weeks.php';
42
    require_once _EXTCAL_PEAR_CALENDAR_ROOT . '/Day.php';
43
    //     require_once CALENDAR_ROOT . 'Month/Weeks.php';
44
    //     require_once CALENDAR_ROOT . 'Day.php';
45
46
    // Retriving Image for block if enabled
47
    if (1 == $options[0]) {
48
        $imageHandler = xoops_getHandler('image');
0 ignored issues
show
Bug introduced by
The function xoops_getHandler was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

48
        $imageHandler = /** @scrutinizer ignore-call */ xoops_getHandler('image');
Loading history...
49
        $criteria     = new \Criteria('imgcat_id', $options[1]);
0 ignored issues
show
Bug introduced by
The type Criteria was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
50
        $criteria->setSort('RAND()');
51
        $criteria->setLimit($options[6]);
52
        $images         = $imageHandler->getObjects($criteria);
53
        $slideShowParam = [
54
            'images'      => $images,
55
            'frameHeight' => $options[3],
56
            'frameWidth'  => $options[2],
57
            'transTime'   => $options[4],
58
            'pauseTime'   => $options[5],
59
        ];
60
        if (count($images) > 0) {
61
            _makeXMLSlideshowConf($slideShowParam);
62
            $imageParam = ['displayImage' => true];
63
        } else {
64
            $imageParam = ['displayImage' => false];
65
        }
66
    } else {
67
        $imageParam = ['displayImage' => false];
68
    }
69
    $imageParam['frameHeight'] = $options[3];
70
    $imageParam['frameWidth']  = $options[2];
71
72
    // Retriving module config
73
    //     $extcalConfig = Extcal\Config::getHandler();
0 ignored issues
show
Unused Code Comprehensibility introduced by
46% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
74
    //$xoopsModuleConfig = $extcalConfig->getModuleConfig();
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
75
    //----------------------------------------------------
76
    //recupe de xoopsmoduleConfig
77
    /** @var XoopsModuleHandler $moduleHandler */
78
    $moduleHandler = xoops_getHandler('module');
79
    $module        = $moduleHandler->getByDirname('extcal');
80
    $configHandler = xoops_getHandler('config');
81
    if ($module) {
82
        $extcalConfig = $configHandler->getConfigsByCat(0, $module->getVar('mid'));
83
    }
84
    //----------------------------------------------------
85
    // Getting eXtCal object's handler
86
    //    $catHandler = xoops_getModuleHandler(_EXTCAL_CLS_CAT, _EXTCAL_MODULE);
0 ignored issues
show
Unused Code Comprehensibility introduced by
39% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
87
    $catHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_CAT);
88
89
    $cats = $catHandler->getAllCatById($xoopsUser);
90
    // $t = print_r($cats,true);
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
91
    // echo "zzz<pre>{$t}</pre>";
92
93
    $eventHandler = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_EVENT);
94
    $timeHandler  = Extcal\Time::getHandler();
95
96
    // Retriving month and year value according to block options
97
    //modif JJD
98
    $offset      = $extcalConfig['offsetMinical'];
99
    $monthToShow = mktime(0, 0, 0, date('m') + $offset, date('d'), date('Y'));
0 ignored issues
show
Bug introduced by
date('Y') of type string is incompatible with the type integer expected by parameter $year of mktime(). ( Ignorable by Annotation )

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

99
    $monthToShow = mktime(0, 0, 0, date('m') + $offset, date('d'), /** @scrutinizer ignore-type */ date('Y'));
Loading history...
Bug introduced by
date('d') of type string is incompatible with the type integer expected by parameter $day of mktime(). ( Ignorable by Annotation )

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

99
    $monthToShow = mktime(0, 0, 0, date('m') + $offset, /** @scrutinizer ignore-type */ date('d'), date('Y'));
Loading history...
100
    $month       = date('n', $monthToShow);
101
    $year        = date('Y', $monthToShow);
102
103
    //----------------------------------------------------
104
    $month += $options[7]; //ajout  ou retrait du nombre de mois de décalage
105
    if ($month < 1) {
106
        $month = 12;
107
        --$year;
108
    } elseif ($month > 12) {
109
        $month = 1;
110
        ++$year;
111
    }
112
    //----------------------------------------------------
113
114
    // Saving display link preference
115
    $displayLink = $options[8];
116
117
    // Delete options to keep only categorie data
118
    $tCatSelected = explode(',', $options[9]);
119
120
    /***************************************************************/
121
    // Retriving events and formatting them
122
    //$events = $eventHandler->objectToArray($eventHandler->getEventCalendarMonth($month, $year, $tCatSelected));
0 ignored issues
show
Unused Code Comprehensibility introduced by
69% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
123
    if (true) {
0 ignored issues
show
Bug introduced by
Avoid IF statements that are always true or false
Loading history...
124
        $criteres = [
125
            'periode'      => _EXTCAL_EVENTS_MONTH,
126
            'month'        => $month,
127
            'year'         => $year,
128
            'category'     => $tCatSelected,
129
            'externalKeys' => 'cat_id',
130
        ];
131
        $events   = $eventHandler->getEventsOnPeriode($criteres);
132
    } else {
133
        $events = [];
134
    }
135
    //Extcal\Utility::echoArray($events, 'minical');
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
136
    /***************************************************************/
137
    //$eventHandler->formatEventDate($events, "l dS \of F Y h:i A");
0 ignored issues
show
Unused Code Comprehensibility introduced by
80% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
138
139
    // Calculating timestamp for the begin and the end of the month
140
    $startMonth = mktime(0, 0, 0, $month, 1, $year);
141
    $endMonth   = mktime(23, 59, 59, $month + 1, 0, $year);
142
143
    /*
144
     *  Adding all event occuring during this month to an array indexed by day number
145
     */
146
    $eventsArray = [];
147
    foreach ($events as $event) {
148
        //echo "id->{$event['event_id']}<br>";
149
        bExtcalMinicalAddEventToArray($event, $eventsArray, $timeHandler, $startMonth, $endMonth, $cats);
150
        //         if (!$event['event_isrecur']) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
151
        //             bExtcalMinicalAddEventToArray($event, $eventsArray, $timeHandler, $startMonth, $endMonth, $cats);
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
152
        //         } else {
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
153
        //
154
        //             $recurEvents = $eventHandler->getRecurEventToDisplay($event, $startMonth, $endMonth);
0 ignored issues
show
Unused Code Comprehensibility introduced by
62% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
155
        //             foreach ($recurEvents as $recurEvent)
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
156
        //             {
157
        //                 bExtcalMinicalAddEventToArray($recurEvent, $eventsArray, $timeHandler, $startMonth, $endMonth, $cats);
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
158
        //             }
159
        //         }
160
    }
161
    //Extcal\Utility::echoArray($eventsArray);
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
162
163
    /*
164
     *  Making an array to create tabbed output on the template
165
     */
166
    // Flag current day
167
    $selectedDays = [
168
        new Calendar_Day(date('Y', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($GLOBALS['xoopsUser']))), date('n', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($GLOBALS['xoopsUser']))),
0 ignored issues
show
Bug introduced by
The function xoops_getUserTimestamp was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

168
        new Calendar_Day(date('Y', /** @scrutinizer ignore-call */ xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($GLOBALS['xoopsUser']))), date('n', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($GLOBALS['xoopsUser']))),
Loading history...
Bug introduced by
date('Y', xoops_getUserT...GLOBALS['xoopsUser']))) of type string is incompatible with the type integer expected by parameter $y of Calendar_Day::__construct(). ( Ignorable by Annotation )

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

168
        new Calendar_Day(/** @scrutinizer ignore-type */ date('Y', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($GLOBALS['xoopsUser']))), date('n', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($GLOBALS['xoopsUser']))),
Loading history...
Bug introduced by
date('n', xoops_getUserT...GLOBALS['xoopsUser']))) of type string is incompatible with the type integer expected by parameter $m of Calendar_Day::__construct(). ( Ignorable by Annotation )

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

168
        new Calendar_Day(date('Y', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($GLOBALS['xoopsUser']))), /** @scrutinizer ignore-type */ date('n', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($GLOBALS['xoopsUser']))),
Loading history...
169
                         date('j', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($GLOBALS['xoopsUser'])))),
0 ignored issues
show
Bug introduced by
date('j', xoops_getUserT...GLOBALS['xoopsUser']))) of type string is incompatible with the type integer expected by parameter $d of Calendar_Day::__construct(). ( Ignorable by Annotation )

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

169
                         /** @scrutinizer ignore-type */ date('j', xoops_getUserTimestamp(time(), $timeHandler->getUserTimeZone($GLOBALS['xoopsUser'])))),
Loading history...
170
    ];
171
172
    // Build calendar object
173
    $monthCalObj = new Calendar_Month_Weeks($year, $month, $extcalConfig['week_start_day']);
0 ignored issues
show
Bug introduced by
$year of type string is incompatible with the type integer expected by parameter $y of Calendar_Month_Weeks::__construct(). ( Ignorable by Annotation )

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

173
    $monthCalObj = new Calendar_Month_Weeks(/** @scrutinizer ignore-type */ $year, $month, $extcalConfig['week_start_day']);
Loading history...
174
    $monthCalObj->build();
175
176
    $tableRows = [];
177
    $rowId     = 0;
178
    $cellId    = 0;
179
    while ($weekCalObj = $monthCalObj->fetch()) {
180
        $weekCalObj->build($selectedDays);
181
        $tableRows[$rowId]['weekInfo'] = [
182
            'week'  => $weekCalObj->thisWeek('n_in_year'),
183
            'day'   => $weekCalObj->thisDay(),
184
            'month' => $monthCalObj->thisMonth(),
185
            'year'  => $monthCalObj->thisYear(),
186
        ];
187
        while ($dayCalObj = $weekCalObj->fetch()) {
188
            $tableRows[$rowId]['week'][$cellId] = [
189
                'isEmpty'    => $dayCalObj->isEmpty(),
190
                'number'     => $dayCalObj->thisDay(),
191
                'isSelected' => $dayCalObj->isSelected(),
192
            ];
193
            $day                                = $dayCalObj->thisDay();
194
            if (isset($eventsArray[$day]) && !$dayCalObj->isEmpty()) {
195
                $tableRows[$rowId]['week'][$cellId]['haveEvents'] = true;
196
                $tableRows[$rowId]['week'][$cellId]['color']      = $eventsArray[$day]['color'];
197
            } else {
198
                $tableRows[$rowId]['week'][$cellId]['haveEvents'] = false;
199
            }
200
            ++$cellId;
201
        }
202
        $cellId = 0;
203
        ++$rowId;
204
    }
205
206
    // Retriving weekdayNames
207
    //$loc_de = setlocale (LC_ALL, 'Fr');
0 ignored issues
show
Unused Code Comprehensibility introduced by
47% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
208
209
    $weekdayNames = Calendar_Util_Textual::weekdayNames('one');
210
    //$weekdayNames=array('D','L','M','M','J','V','S');
0 ignored issues
show
Unused Code Comprehensibility introduced by
95% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
211
212
    //     echo "<hr>L'identifiant de l'allemand sur ce système est '$loc_de'";
213
    //     echoArray($weekdayNames,true);
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
214
215
    for ($i = 0; $i < $extcalConfig['week_start_day']; ++$i) {
216
        $weekdayName    = array_shift($weekdayNames);
217
        $weekdayNames[] = $weekdayName;
218
    }
219
220
    // Making navig data
221
    $navig = [
222
        'page' => $extcalConfig['start_page'],
223
        'uri'  => 'year=' . $monthCalObj->thisYear() . '&amp;month=' . $monthCalObj->thisMonth(),
224
        'name' => $timeHandler->getFormatedDate($extcalConfig['nav_date_month'], $monthCalObj->getTimestamp()),
225
    ];
226
227
    $horloge             = [];
228
    $horloge['display']  = ('' != trim($options[11]));
229
    $horloge['fullName'] = XOOPS_URL . _EXTCAL_PATH_HORLOGES . $options[11];
0 ignored issues
show
Bug introduced by
The constant XOOPS_URL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
230
    $horloge['width']    = $options[12] . 'px';
231
    $horloge['height']   = $options[13] . 'px';
232
233
    $ret = [
234
        'imageParam'   => $imageParam,
235
        'displayLink'  => $displayLink,
236
        'submitText'   => _MB_EXTCAL_SUBMIT_LINK_TEXT,
237
        'tableRows'    => $tableRows,
238
        'weekdayNames' => $weekdayNames,
239
        'navig'        => $navig,
240
        'horloge'      => $horloge,
241
        'bgColor'      => $options[10],
242
    ];
243
244
    // $t = print_r($horloge,true);
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
245
    // echo "<pre>{$t}</pre>";
246
    return $ret;
247
}
248
249
//---------------------------------------------------------------------------
250
/**
251
 * @param $options
252
 *
253
 * @return string
254
 */
255
function bExtcalMinicalEdit($options)
256
{
257
    //    // require_once __DIR__ . '/../class/form/spin/formspin.php';
258
    global $xoopsUser;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
259
260
    //  $t = print_r(get_defined_vars(),true);
0 ignored issues
show
Unused Code Comprehensibility introduced by
58% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
261
    // // $t = print_r($options,true);
262
    //  echo "<pre>{$t}</pre>";
263
264
    extcal_getDefautminicalOption($options);
265
266
    $xfValue = [];
267
268
    $form = new Extcal\TableForm(_OPTIONS, '', '');
0 ignored issues
show
Bug introduced by
The constant _OPTIONS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
269
    //$form->setExtra('enctype="multipart/form-data"');
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
270
271
    //============================================================
272
273
    $catHandler      = Extcal\Helper::getInstance()->getHandler(_EXTCAL_CLN_CAT);
274
    $cats            = $catHandler->getAllCat($xoopsUser, 'extcal_cat_view');
275
    $imageCatHandler = xoops_getHandler('imagecategory');
0 ignored issues
show
Bug introduced by
The function xoops_getHandler was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

275
    $imageCatHandler = /** @scrutinizer ignore-call */ xoops_getHandler('imagecategory');
Loading history...
276
277
    //=====================================================================
278
    $form->insertBreak('<div style="text-align: center;font-weight: bold;">' . _MB_EXTCAL_OPT_SLIDE_SHOW . '</div>', 'head');
279
280
    $k           = 0;
281
    $xfValue[$k] = new \XoopsFormRadio(_MB_EXTCAL_DISPLAY_IMG, "options[{$k}]", $options[$k]);
0 ignored issues
show
Bug introduced by
The type XoopsFormRadio was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
282
    $xfValue[$k]->addOption(1, _YES);
0 ignored issues
show
Bug introduced by
The constant _YES was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
283
    $xfValue[$k]->addOption(0, _NO);
0 ignored issues
show
Bug introduced by
The constant _NO was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
284
285
    $form->addElement($xfValue[$k], false);
286
    //---------------------------------------------------------------------
287
    $imageCats = $imageCatHandler->getObjects();
288
    $t         = [];
289
    $t[0]      = _NONE;
0 ignored issues
show
Bug introduced by
The constant _NONE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
290
    foreach ($imageCats as $cat) {
291
        $t[$cat->getVar('imgcat_id')] = $cat->getVar('imgcat_name');
292
    }
293
294
    $k           = 1;
295
    $xfValue[$k] = new \XoopsFormSelect(_MB_EXTCAL_IMG_CAT, "options[{$k}]", $options[$k], 1, false);
0 ignored issues
show
Bug introduced by
The type XoopsFormSelect was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
296
    $xfValue[$k]->addOptionArray($t);
297
    $form->addElement($xfValue[$k], false);
298
    //---------------------------------------------------------------------
299
    $k           = 2;
300
    $xfValue[$k] = new Extcal\Form\Spin\FormSpin(_MB_EXTCAL_SS_WIDTH, "options[{$k}]", $options[$k], 100, 250, 1, 0, 8, _MB_EXTCAL_PX, $imgFolder = '');
301
    $form->addElement($xfValue[$k], false);
302
    //---------------------------------------------------------------------
303
    $k           = 3;
304
    $xfValue[$k] = new Extcal\Form\Spin\FormSpin(_MB_EXTCAL_SS_HEIGHT, "options[{$k}]", $options[$k], 100, 250, 1, 0, 8, _MB_EXTCAL_PX, $imgFolder = '');
305
    $form->addElement($xfValue[$k], false);
306
    //---------------------------------------------------------------------
307
    $k           = 4;
308
    $xfValue[$k] = new Extcal\Form\Spin\FormSpin(_MB_EXTCAL_SS_TRANS_TIME, "options[{$k}]", $options[$k], 0, 12, 1, 0, 8, _MB_EXTCAL_PX, $imgFolder = '');
309
    $form->addElement($xfValue[$k], false);
310
    //---------------------------------------------------------------------
311
    $k           = 5;
312
    $xfValue[$k] = new Extcal\Form\Spin\FormSpin(_MB_EXTCAL_SS_PAUSE_TIME, "options[{$k}]", $options[$k], 0, 12, 1, 0, 8, _MB_EXTCAL_PX, $imgFolder = '');
313
    $form->addElement($xfValue[$k], false);
314
    //---------------------------------------------------------------------
315
    $k           = 6;
316
    $xfValue[$k] = new Extcal\Form\Spin\FormSpin(_MB_EXTCAL_SS_NB_PHOTOS, "options[{$k}]", $options[$k], 0, 50, 1, 0, 8, _MB_EXTCAL_PX, $imgFolder = '');
317
    $form->addElement($xfValue[$k], false);
318
    //=====================================================================
319
    $form->insertBreak('<div style="text-align: center;font-weight: bold;">' . _MB_EXTCAL_OPT_SHOW . '</div>', 'head');
320
321
    $t = [
322
        -1 => _MB_EXTCAL_PREVIEW,
323
        0  => _MB_EXTCAL_CURRENT,
324
        1  => _MB_EXTCAL_NEXT,
325
    ];
326
327
    $k           = 7;
328
    $xfValue[$k] = new \XoopsFormSelect(_MB_EXTCAL_DISPLAY_MONTH, "options[{$k}]", $options[$k], 1, false);
329
    $xfValue[$k]->addOptionArray($t);
330
    $form->addElement($xfValue[$k], false);
331
    //---------------------------------------------------------------------
332
    $k           = 8;
333
    $xfValue[$k] = new \XoopsFormRadio(_MB_EXTCAL_DISPLAY_SUBMIT_LINK, "options[{$k}]", $options[$k]);
334
    $xfValue[$k]->addOption(1, _YES);
335
    $xfValue[$k]->addOption(0, _NO);
336
337
    $form->addElement($xfValue[$k], false);
338
    //---------------------------------------------------------------------
339
    //for ($h=0;$h<8;++$h) array_shift($options);
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
340
    $t = [];
341
    foreach ($cats as $cat) {
342
        $t[$cat->getVar('cat_id')] = $cat->getVar('cat_name');
343
    }
344
345
    //function XoopsFormSelect($caption, $name, $value = null, $size = 1, $multiple = false)
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
346
347
    $k           = 9;
348
    $xfValue[$k] = new \XoopsFormSelect(_MB_EXTCAL_CAT_TO_USE, "options[{$k}]", explode(',', $options[$k]), 8, true);
349
    $xfValue[$k]->setDescription(_MB_EXTCAL_CAT_TO_USE_DESC);
350
    $xfValue[$k]->addOptionArray($t);
351
    $form->addElement($xfValue[$k], false);
352
    //---------------------------------------------------------------------
353
    $k           = 10;
354
    $xfValue[$k] = new \XoopsFormColorPicker(_MB_EXTCAL_BGCOLOR, "options[{$k}]", $options[$k]);
0 ignored issues
show
Bug introduced by
The type XoopsFormColorPicker was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
355
    $form->addElement($xfValue[$k], false);
356
357
    //=====================================================================
358
    $form->insertBreak('<div style="text-align: center;font-weight: bold;">' . _MB_EXTCAL_HORLOGE_OPT . '</div>', 'head');
359
    //---------------------------------------------------------------------
360
    $t = \XoopsLists::getFileListAsArray(XOOPS_ROOT_PATH . _EXTCAL_PATH_HORLOGES);
0 ignored issues
show
Bug introduced by
The type XoopsLists was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
Bug introduced by
The constant XOOPS_ROOT_PATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
361
    $t = array_merge([' ' => _NONE], $t);
362
363
    $k           = 11;
364
    $xfValue[$k] = new \XoopsFormSelect(_MB_EXTCAL_HORLOGE, "options[{$k}]", $options[$k], 1, false);
365
    $xfValue[$k]->addOptionArray($t);
366
    $form->addElement($xfValue[$k], false);
367
368
    //---------------------------------------------------------------------
369
    $k           = 12;
370
    $xfValue[$k] = new Extcal\Form\Spin\FormSpin(_MB_EXTCAL_WIDTH, "options[{$k}]", $options[$k], 50, 250, 1, 0, 8, _MB_EXTCAL_PX, $imgFolder = '');
371
    $form->addElement($xfValue[$k], false);
372
    //---------------------------------------------------------------------
373
    $k           = 13;
374
    $xfValue[$k] = new Extcal\Form\Spin\FormSpin(_MB_EXTCAL_HEIGHT, "options[{$k}]", $options[$k], 50, 250, 1, 0, 8, _MB_EXTCAL_PX, $imgFolder = '');
375
    $form->addElement($xfValue[$k], false);
376
    //---------------------------------------------------------------------
377
    //=====================================================================
378
    return $form->render();
379
    /*
0 ignored issues
show
Unused Code Comprehensibility introduced by
61% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
380
              $t = array();
381
              //while (list($key,$val) = each($xfValue)) {
382
                foreach ($xfValue as $key => $val) {
383
               $t[] = $val->render();
384
              }
385
             return implode("\n", $t);
386
387
            return extcal_buildHtmlArray($xfValue, _OPTIONS);
388
    */
389
}
390
391
/**************************************************************************/
392
/**
393
 * @param $options
394
 */
395
function _makeXMLSlideshowConf($options)
396
{
397
398
    // create a  new \XML document
399
    $doc               = new DomDocument('1.0');
400
    $doc->formatOutput = true;
401
402
    // create root node
403
    $root = $doc->createElement('slideshow');
404
    $root = $doc->appendChild($root);
405
406
    // Create config node
407
    $config = $doc->createElement('config');
408
    $config = $root->appendChild($config);
409
410
    // Add config param
411
    $frameHeight = $doc->createElement('frameHeight');
412
    $frameHeight = $config->appendChild($frameHeight);
413
    $value       = $doc->createTextNode($options['frameHeight']);
414
    $frameHeight->appendChild($value);
415
416
    $frameWidth = $doc->createElement('frameWidth');
417
    $frameWidth = $config->appendChild($frameWidth);
418
    $value      = $doc->createTextNode($options['frameWidth']);
419
    $frameWidth->appendChild($value);
420
421
    $transTime = $doc->createElement('transTime');
422
    $transTime = $config->appendChild($transTime);
423
    $value     = $doc->createTextNode($options['transTime']);
424
    $transTime->appendChild($value);
425
426
    $pauseTime = $doc->createElement('pauseTime');
427
    $pauseTime = $config->appendChild($pauseTime);
428
    $value     = $doc->createTextNode($options['pauseTime']);
429
    $pauseTime->appendChild($value);
430
431
    // Add photos node
432
    $photos = $doc->createElement('photos');
433
    $photos = $root->appendChild($photos);
434
435
    $tempPhoto = $doc->createElement('photo');
436
    $tempSrc   = $doc->createElement('src');
437
    foreach ($options['images'] as $images) {
438
        // $photo = $doc->createElement('photo');
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
439
        $photo = clone $tempPhoto;
440
        $photo = $photos->appendChild($photo);
441
442
        // $src   = $doc->createElement('src');
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
443
        $src   = clone $tempSrc;
444
        $src   = $photo->appendChild($src);
445
        $value = $doc->createTextNode(XOOPS_URL . '/uploads/' . $images->getVar('image_name'));
0 ignored issues
show
Bug introduced by
The constant XOOPS_URL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
446
        $src->appendChild($value);
447
    }
448
449
    // get completed xml document
450
    $xml_string = $doc->save(XOOPS_ROOT_PATH . '/cache/extcalSlideShowParam.xml');
0 ignored issues
show
Bug introduced by
The constant XOOPS_ROOT_PATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
Unused Code introduced by
The assignment to $xml_string is dead and can be removed.
Loading history...
451
}
452
453
/**************************************************************************/
454
/**
455
 * @param array      $event
456
 * @param array      $eventsArray
457
 * @param Extcal\Time       $timeHandler
458
 * @param            $startMonth
459
 * @param            $endMonth
460
 * @param            $cats
461
 *
462
 * @return bool
463
 */
464
function bExtcalMinicalAddEventToArray($event, &$eventsArray, $timeHandler, $startMonth, $endMonth, $cats)
0 ignored issues
show
Unused Code introduced by
The parameter $cats 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

464
function bExtcalMinicalAddEventToArray($event, &$eventsArray, $timeHandler, $startMonth, $endMonth, /** @scrutinizer ignore-unused */ $cats)

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...
465
{
466
    // Extcal\Utility::echoArray($event);
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
467
    // exit;
468
    // $d1 = date("j, m, Y", $startMonth);
0 ignored issues
show
Unused Code Comprehensibility introduced by
54% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
469
    // $d2 = date("j, m, Y", $endMonth);
0 ignored issues
show
Unused Code Comprehensibility introduced by
54% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
470
    // echo "bExtcalMinicalAddEventToArray : {$d1} - {$d2}<br>";
471
    // $d1 = date("j, m, Y", $event['event_start']);
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
472
    // $d2 = date("j, m, Y", $event['event_end']);
0 ignored issues
show
Unused Code Comprehensibility introduced by
63% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
473
    // echo "bExtcalMinicalAddEventToArray : {$d1} - {$d2}<br>";
474
475
    //     $color  = $cats[$event['cat_id']]['cat_color'];
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
476
    //     $weight = $cats[$event['cat_id']]['cat_weight'];
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
477
    $color  = $event['cat']['cat_color'];
478
    $weight = $event['cat']['cat_weight'];
479
480
    // Calculating the start and the end of the event
481
    $startEvent = xoops_getUserTimestamp($event['event_start'], $timeHandler->getUserTimeZone($GLOBALS['xoopsUser']));
0 ignored issues
show
Bug introduced by
The function xoops_getUserTimestamp was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

481
    $startEvent = /** @scrutinizer ignore-call */ xoops_getUserTimestamp($event['event_start'], $timeHandler->getUserTimeZone($GLOBALS['xoopsUser']));
Loading history...
482
    $endEvent   = xoops_getUserTimestamp($event['event_end'], $timeHandler->getUserTimeZone($GLOBALS['xoopsUser']));
483
    // Extcal\Utility::echoTsu($event['event_start'],"event['event_start']");
0 ignored issues
show
Unused Code Comprehensibility introduced by
77% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
484
    // Extcal\Utility::echoTsu($event['event_end'],"event['event_end']");
0 ignored issues
show
Unused Code Comprehensibility introduced by
77% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
485
486
    //---------------------------------------------------------------
487
    if ($startEvent < $startMonth) {
488
        $firstDay = 1;
0 ignored issues
show
Unused Code introduced by
The assignment to $firstDay is dead and can be removed.
Loading history...
489
    } elseif ($startEvent > $endEvent) {
490
        return false;
491
    } else {
492
        $firstDay = date('j', $startEvent);
493
    }
494
495
    if ($endEvent < $startMonth) {
496
        return false;
497
    } elseif ($endEvent > $endMonth) {
498
        $lastDay = date('j', $endMonth);
0 ignored issues
show
Unused Code introduced by
The assignment to $lastDay is dead and can be removed.
Loading history...
499
    } else {
500
        $lastDay = date('j', $endEvent);
501
    }
502
503
    //echo "first dat - last day : {$firstDay} - {$lastDay}<br>";
504
    //echo $event['event_id'] . '-' . $weight .'<br>';
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
505
506
    $d = date('j', $event['event_start']);
507
    if (isset($eventsArray[$d])) {
508
        if ($weight > $eventsArray[$d]['weight']) {
509
            $eventsArray[$d]['weight'] = $weight;
510
            $eventsArray[$d]['color']  = $color;
511
        }
512
    } else {
513
        $eventsArray[$d]['hasEvent'] = true;
514
        $eventsArray[$d]['weight']   = $weight;
515
        $eventsArray[$d]['color']    = $color;
516
    }
517
    /*
0 ignored issues
show
Unused Code Comprehensibility introduced by
65% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
518
            for ($i = $firstDay; $i <= $lastDay; ++$i) {
519
                }
520
521
                $eventsArray[$i]['hasEvent'] = true;
522
                if (isset($eventsArray[$i]['weight'])) {
523
                  if ($weight > $eventsArray[$i]['weight']) {
524
                    $eventsArray[$i]['weight'] = $weight;
525
                    $eventsArray[$i]['color'] = $color;
526
                  }
527
                } else {
528
                  $eventsArray[$i]['weight'] = $weight;
529
                  $eventsArray[$i]['color'] = $color;
530
              }
531
            }
532
    */
533
534
    // $t = print_r($cats,true);
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
535
    // echo "<pre>{$t}</pre><hr>";
536
    //
537
    // $t = print_r($eventsArray,true);
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
538
    // echo "event id = {$event['event_id']} - weight = {$weight}<br>color = {$color}<br><pre>{$t}</pre><hr>";
539
}
540
541
/**
542
 * @param $options
543
 */
544
function extcal_getDefautminicalOption(&$options)
545
{
546
    // 0|0|150|225|1|3|10|0|1|1,2|| |120|120
0 ignored issues
show
Unused Code Comprehensibility introduced by
93% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
547
    for ($h = 0; $h <= 13; ++$h) {
548
        if (!isset($options[$h])) {
549
            switch ($h) {
550
                case  0:
0 ignored issues
show
Coding Style introduced by
As per coding-style, case should be followed by a single space.

As per the PSR-2 coding standard, there must be a space after the case keyword, instead of the test immediately following it.

switch (true) {
    case!isset($a):  //wrong
        doSomething();
        break;
    case !isset($b):  //right
        doSomething();
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
551
                    $options[$h] = '0';
552
                    break;
553
                case  1:
0 ignored issues
show
Coding Style introduced by
As per coding-style, case should be followed by a single space.

As per the PSR-2 coding standard, there must be a space after the case keyword, instead of the test immediately following it.

switch (true) {
    case!isset($a):  //wrong
        doSomething();
        break;
    case !isset($b):  //right
        doSomething();
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
554
                    $options[$h] = 0;
555
                    break;
556
                case  2:
0 ignored issues
show
Coding Style introduced by
As per coding-style, case should be followed by a single space.

As per the PSR-2 coding standard, there must be a space after the case keyword, instead of the test immediately following it.

switch (true) {
    case!isset($a):  //wrong
        doSomething();
        break;
    case !isset($b):  //right
        doSomething();
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
557
                    $options[$h] = '150';
558
                    break;
559
                case  3:
0 ignored issues
show
Coding Style introduced by
As per coding-style, case should be followed by a single space.

As per the PSR-2 coding standard, there must be a space after the case keyword, instead of the test immediately following it.

switch (true) {
    case!isset($a):  //wrong
        doSomething();
        break;
    case !isset($b):  //right
        doSomething();
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
560
                    $options[$h] = '255';
561
                    break;
562
                case  4:
0 ignored issues
show
Coding Style introduced by
As per coding-style, case should be followed by a single space.

As per the PSR-2 coding standard, there must be a space after the case keyword, instead of the test immediately following it.

switch (true) {
    case!isset($a):  //wrong
        doSomething();
        break;
    case !isset($b):  //right
        doSomething();
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
563
                    $options[$h] = '1';
564
                    break;
565
                case  5:
0 ignored issues
show
Coding Style introduced by
As per coding-style, case should be followed by a single space.

As per the PSR-2 coding standard, there must be a space after the case keyword, instead of the test immediately following it.

switch (true) {
    case!isset($a):  //wrong
        doSomething();
        break;
    case !isset($b):  //right
        doSomething();
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
566
                    $options[$h] = '3';
567
                    break;
568
                case  6:
0 ignored issues
show
Coding Style introduced by
As per coding-style, case should be followed by a single space.

As per the PSR-2 coding standard, there must be a space after the case keyword, instead of the test immediately following it.

switch (true) {
    case!isset($a):  //wrong
        doSomething();
        break;
    case !isset($b):  //right
        doSomething();
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
569
                    $options[$h] = '10';
570
                    break;
571
                case  7:
0 ignored issues
show
Coding Style introduced by
As per coding-style, case should be followed by a single space.

As per the PSR-2 coding standard, there must be a space after the case keyword, instead of the test immediately following it.

switch (true) {
    case!isset($a):  //wrong
        doSomething();
        break;
    case !isset($b):  //right
        doSomething();
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
572
                    $options[$h] = '0';
573
                    break;
574
                case  8:
0 ignored issues
show
Coding Style introduced by
As per coding-style, case should be followed by a single space.

As per the PSR-2 coding standard, there must be a space after the case keyword, instead of the test immediately following it.

switch (true) {
    case!isset($a):  //wrong
        doSomething();
        break;
    case !isset($b):  //right
        doSomething();
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
575
                    $options[$h] = '1';
576
                    break;
577
                case  9:
0 ignored issues
show
Coding Style introduced by
As per coding-style, case should be followed by a single space.

As per the PSR-2 coding standard, there must be a space after the case keyword, instead of the test immediately following it.

switch (true) {
    case!isset($a):  //wrong
        doSomething();
        break;
    case !isset($b):  //right
        doSomething();
        break;
}

To learn more about the PSR-2 coding standard, please refer to the PHP-Fig.

Loading history...
578
                    $options[$h] = '1,2,3,4,5';
579
                    break;
580
                case 10:
581
                    $options[$h] = '';
582
                    break;
583
                case 11:
584
                    $options[$h] = '';
585
                    break;
586
                case 12:
587
                    $options[$h] = 120;
588
                    break;
589
                case 13:
590
                    $options[$h] = 120;
591
                    break;
592
            }
593
        }
594
    }
595
}
596