public function __construct($rrule = null, $startDate = null, $endDate = null, $timezone = null)
{
if (empty($timezone)) {
if ($startDate instanceof \DateTime) {
$timezone = $startDate->getTimezone()->getName();
} else {
$timezone = date_default_timezone_get();
}
}
$this->setTimezone($timezone);
if (!$startDate instanceof \DateTime) {
$startDate = new \DateTime($startDate, new \DateTimeZone($timezone));
}
$this->setStartDate($startDate);
$this->setEndDate($endDate);
if (is_array($rrule)) {
$this->loadFromArray($rrule);
} else {
if (!empty($rrule)) {
$this->loadFromString($rrule);
}
}
}