Code Duplication    Length = 18-18 lines in 2 locations

class/pear/Calendar/Engine/UnixTS.php 1 location

@@ 324-341 (lines=18) @@
321
     *
322
     * @return int weeks number
323
     */
324
    public function getWeeksInMonth($y, $m, $firstDay = 1)
325
    {
326
        $FDOM = $this->getFirstDayInMonth($y, $m);
327
        if (0 == $FDOM) {
328
            $FDOM = $this->getDaysInWeek();
329
        }
330
        if ($FDOM > $firstDay) {
331
            $daysInTheFirstWeek = $this->getDaysInWeek() - $FDOM + $firstDay;
332
            $weeks              = 1;
333
        } else {
334
            $daysInTheFirstWeek = $firstDay - $FDOM;
335
            $weeks              = 0;
336
        }
337
        $daysInTheFirstWeek %= $this->getDaysInWeek();
338
339
        return (int)(ceil(($this->getDaysInMonth($y, $m) - $daysInTheFirstWeek) / $this->getDaysInWeek()) + $weeks);
340
    }
341
342
    /**
343
     * Returns the number of the day of the week (0=sunday, 1=monday...).
344
     *

class/pear/Calendar/Engine/PearDate.php 1 location

@@ 369-386 (lines=18) @@
366
     *
367
     * @return int weeks number
368
     */
369
    public function getWeeksInMonth($y, $m, $firstDay = 1)
370
    {
371
        $FDOM = Date_Calc::firstOfMonthWeekday($m, $y);
372
        if (0 == $FDOM) {
373
            $FDOM = $this->getDaysInWeek();
374
        }
375
        if ($FDOM > $firstDay) {
376
            $daysInTheFirstWeek = $this->getDaysInWeek() - $FDOM + $firstDay;
377
            $weeks              = 1;
378
        } else {
379
            $daysInTheFirstWeek = $firstDay - $FDOM;
380
            $weeks              = 0;
381
        }
382
        $daysInTheFirstWeek %= $this->getDaysInWeek();
383
384
        return (int)(ceil(($this->getDaysInMonth($y, $m) - $daysInTheFirstWeek) / $this->getDaysInWeek()) + $weeks);
385
    }
386
387
    /**
388
     * Returns the number of the day of the week (0=sunday, 1=monday...).
389
     *