Code Duplication    Length = 12-13 lines in 2 locations

src/LaravelEventsCalendar.php 1 location

@@ 16-27 (lines=12) @@
13
     * @param  string  date in the d/m/Y format
14
     * @return string  date in the Y-m-d format
15
     */
16
    public static function formatDatePickerDateForMysql($DatePickerDate)
17
    {
18
        if ($DatePickerDate) {
19
            list($tid, $tim, $tiy) = explode('/', $DatePickerDate);
20
            $ret = "$tiy-$tim-$tid";
21
        } else {
22
            date_default_timezone_set('Europe/Rome');
23
            $ret = date('Y-m-d', time());
24
        }
25
26
        return $ret;
27
    }
28
29
    /***************************************************************************/
30
}

src/Models/Event.php 1 location

@@ 213-225 (lines=13) @@
210
     * @param string $DatePickerStartDate
211
     * @return string
212
     */
213
    public static function prepareStartDate($DatePickerStartDate)
214
    {
215
        if ($DatePickerStartDate) {
216
            list($tid, $tim, $tiy) = explode('/', $DatePickerStartDate);
217
            $ret = "$tiy-$tim-$tid";
218
        } else {
219
            // If no start date selected the search start from today's date
220
            date_default_timezone_set('Europe/Rome');
221
            $ret = date('Y-m-d', time());
222
        }
223
224
        return $ret;
225
    }
226
227
    /***************************************************************************/
228