public static function getDateRangeForPeriod($date, $period, $lastN = false)
    {
        if ($date === false) {
            return array(false, false);
        }

        $isMultiplePeriod = Range::isMultiplePeriod($date, $period);

        // if the range is just a normal period (or the period is a range in which case lastN is ignored)
        if ($period == 'range') {
            $oPeriod = new Range('day', $date);
            $startDate = $oPeriod->getDateStart();
            $endDate = $oPeriod->getDateEnd();
        } else if ($lastN == false && !$isMultiplePeriod) {
            $oPeriod = Period\Factory::build($period, Date::factory($date));
            $startDate = $oPeriod->getDateStart();
            $endDate = $oPeriod->getDateEnd();
        } else { // if the range includes the last N periods or is a multiple period
            if (!$isMultiplePeriod) {
                list($date, $lastN) = EvolutionViz::getDateRangeAndLastN($period, $date, $lastN);
            }
            list($startDate, $endDate) = explode(',', $date);

            $startDate = Date::factory($startDate);
            $endDate = Date::factory($endDate);
        }
        return array($startDate, $endDate);
    }
public static function getDateRangeForPeriod($date, $period, $lastN = false)
    {
        if ($date === false) {
            return array(false, false);
        }

        $isMultiplePeriod = Range::isMultiplePeriod($date, $period);

        // if the range is just a normal period (or the period is a range in which case lastN is ignored)
        if ($period == 'range') {
            $oPeriod = new Range('day', $date);
            $startDate = $oPeriod->getDateStart();
            $endDate = $oPeriod->getDateEnd();
        } else if ($lastN == false && !$isMultiplePeriod) {
            $oPeriod = Period\Factory::build($period, Date::factory($date));
            $startDate = $oPeriod->getDateStart();
            $endDate = $oPeriod->getDateEnd();
        } else { // if the range includes the last N periods or is a multiple period
            if (!$isMultiplePeriod) {
                list($date, $lastN) = EvolutionViz::getDateRangeAndLastN($period, $date, $lastN);
            }
            list($startDate, $endDate) = explode(',', $date);

            $startDate = Date::factory($startDate);
            $endDate = Date::factory($endDate);
        }
        return array($startDate, $endDate);
    }
public static function getDateRangeForPeriod ( $ date , $ period , $ lastN = false ) { if ( $ date === false ) { return array ( false , false ) ; } $ isMultiplePeriod = Range :: isMultiplePeriod ( $ date , $ period ) ; // if the range is just a normal period (or the period is a range in which case lastN is ignored) if ( $ period == 'range' ) { $ oPeriod = new Range ( 'day' , $ date ) ; $ startDate = $ oPeriod -> getDateStart ( ) ; $ endDate = $ oPeriod -> getDateEnd ( ) ; } else if ( $ lastN == false && ! $ isMultiplePeriod ) { $ oPeriod = Period \ Factory :: build ( $ period , Date :: factory ( $ date ) ) ; $ startDate = $ oPeriod -> getDateStart ( ) ; $ endDate = $ oPeriod -> getDateEnd ( ) ; } else { // if the range includes the last N periods or is a multiple period if ( ! $ isMultiplePeriod ) { list ( $ date , $ lastN ) = EvolutionViz :: getDateRangeAndLastN ( $ period , $ date , $ lastN ) ; } list ( $ startDate , $ endDate ) = explode ( ',' , $ date ) ; $ startDate = Date :: factory ( $ startDate ) ; $ endDate = Date :: factory ( $ endDate ) ; } return array ( $ startDate , $ endDate ) ; }
Returns start & end dates for the range described by a period and optional lastN
argument.

@param string|bool $date The start date of the period (or the date range of a range
period).
@param string $period The period type ('day', 'week', 'month', 'year' or 'range').
@param bool|int $lastN Whether to include the last N periods in the range or not.
Ignored if period == range.

@return Date[]   array of Date objects or array(false, false)
@ignore
Returns start & end dates for the range described by a period and optional lastN argument .