* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class Calendar implements Iterator, Countable { /** @var \DateTime */ protected $date; /** @var \DateTime */ private $itDate; public function __construct(\DateTime $date = null, DateTimeZone $timezone = null) { $this->setDate($date !== null ? $date : new \DateTime()); if ($timezone !== null) { $this->setTimezone($timezone); } } /** * Sets the underlying datetime object and removes the timepart of the * datetime object * * @param \DateTime $date * @return void */ public function setDate(\DateTime $date) { $this->date = $date->setTime(0, 0, 0); } public function getDate() { return $this->date; } public function setTimezone(DateTimeZone $timezone) { $this->date->setTimezone($timezone); } public function getTimezone() { return $this->date->getTimezone(); } /** * Return the days of the current month and year * * @return integer */ public function getDays() { return cal_days_in_month(CAL_GREGORIAN, $this->date->format('n'), $this->date->format('Y')); } /** * Returns the easter date for the current year * * @return \PSX\DateTime\DateTime */ public function getEasterDate() { $easter = new \DateTime($this->getYear() . '-03-21'); $days = easter_days($this->getYear()); return $easter->add(new DateInterval('P' . $days . 'D')); } public function getWeekNumber() { return $this->date->format('W'); } public function getDay() { return $this->date->format('j'); } public function getMonth() { return $this->date->format('n'); } public function getYear() { return $this->date->format('Y'); } public function getMonthName() { return $this->date->format('F'); } public function add(DateInterval $interval) { $this->date->add($interval); return $this; } public function sub(DateInterval $interval) { $this->date->sub($interval); return $this; } public function nextDay() { return $this->add(new DateInterval('P1D')); } public function prevDay() { return $this->sub(new DateInterval('P1D')); } public function nextMonth() { return $this->add(new DateInterval('P1M')); } public function prevMonth() { return $this->sub(new DateInterval('P1M')); } public function nextYear() { return $this->add(new DateInterval('P1Y')); } public function prevYear() { return $this->sub(new DateInterval('P1Y')); } public function count() { return $this->getDays(); } public function current() { return $this->itDate; } public function key() { return $this->itDate->format('j'); } public function next() { $this->itDate->add(new DateInterval('P1D'))->setTime(0, 0, 0); } public function rewind() { $this->itDate = new \DateTime($this->getYear() . '-' . $this->getMonth() . '-01'); } public function valid() { return $this->date->format('n') == $this->itDate->format('n'); } } __halt_compiler();----SIGNATURE:----CeyGnAlHCM6XRqakSQuyjkIsTF+w/yNN3M2flSpP9IQcEBAd3cZPVq9vvcXl3llPm1fzjBUGkQzc3zlCmfHKdpMsPgm+yqfL8vUnL/0HL3+xYLgxu8uhmadOaHNV3PUkgMDcM1QTjKcEvrJ6zv69c+Udx7yJfjwSSwPGi1RRNNqstZdgjbEBxwYSzCtDh3ePHQVaTeFC2jQwkJefxFv+Qcn0vfAF3LXOuADYC0RsbaD71jg0VQDd75gNjDGqaAal8zuHdG/CpYG8NhK2P/NYPhh0Mn6DapLqtmrrUGfnhobQdDQvDvuBx7tK/K7aXNkUdzdsfDymed3kJPxYxdLWG5y7lwlWCrL9HiLEIm3CnsHp0lnT/3/yw1bKGNSDB6A4CHFtQtEfmuPpYBQ9RG/Zm3dkr5DwKVJzj4Vt70deN4uLSmUKK57uhk9Cq8S242P4MyTA/5YzdSDhyxg9Bc0ofhrS4FDIC/eJaWrfmcYFJt1+7yk1zDNPXlFnr+O4XnQcLKdc17Sc4Doek8H0cEfLXWRMkOwcWqjAduMEEG+YRTvYD56qMPAxMwMRAJhzJoFu8ieViMD8cnVwLnVeKXFSF9yvYOaDKOhnMM9HiZXDnenw+RRbllJIaijm/y2pKX7CkNLZ1bFc4nmGZc9/9Qoif0sH4QxjlquQGfvrhhjmbrk=----ATTACHMENT:----NzQ1NTA0NDUyMzY1NCA5MDkwMTUzOTEyMDQzOTk3IDk3MjA0OTc4NTE5MjExMzU=