src/Krucas/Counter/Counter.php
protected function getRanges(\DatePeriod $period)
    {
        $ranges = array();

        $start = null;
        $end = null;
        $single = true;

        foreach ($period as $i => $date) {
            // Set single date
            $ranges[$i] = $date;

            // This is interval, so set it.
            if ($i > 0) {
                $ranges[$i - 1] = new DateRange($ranges[$i - 1], $date);
                $single = false;
            }
        }

        // Ranges are stored, so we don't need las element
        if (!$single) {
            array_pop($ranges);
        }

        return $ranges;
    }
protected function getRanges(\DatePeriod $period)
    {
        $ranges = array();

        $start = null;
        $end = null;
        $single = true;

        foreach ($period as $i => $date) {
            // Set single date
            $ranges[$i] = $date;

            // This is interval, so set it.
            if ($i > 0) {
                $ranges[$i - 1] = new DateRange($ranges[$i - 1], $date);
                $single = false;
            }
        }

        // Ranges are stored, so we don't need las element
        if (!$single) {
            array_pop($ranges);
        }

        return $ranges;
    }
protected function getRanges ( \ DatePeriod $ period ) { $ ranges = array ( ) ; $ start = null ; $ end = null ; $ single = true ; foreach ( $ period as $ i => $ date ) { // Set single date $ ranges [ $ i ] = $ date ; // This is interval, so set it. if ( $ i > 0 ) { $ ranges [ $ i - 1 ] = new DateRange ( $ ranges [ $ i - 1 ] , $ date ) ; $ single = false ; } } // Ranges are stored, so we don't need las element if ( ! $ single ) { array_pop ( $ ranges ) ; } return $ ranges ; }
Generate date ranges from given period.

@param \DatePeriod $period Date period.
@return array
Generate date ranges from given period .