Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

New drivers.

  • Loading branch information...
commit 8b7ff7b7afe9355d181c62ff45f895d3fe6dacde 1 parent 4dd63a7
@kenguest kenguest authored
View
427 Date/Holidays/Driver/Czech.php
@@ -0,0 +1,427 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+/**
+ * Driver for holidays in Czech Republic
+ *
+ * PHP Version 4
+ *
+ * Copyright (c) 1997-2008 The PHP Group
+ *
+ * This source file is subject to version 3.0 of the PHP license,
+ * that is bundled with this package in the file LICENSE, and is
+ * available at through the world-wide-web at
+ * http://www.php.net/license/3_01.txt.
+ * If you did not receive a copy of the PHP license and are unable to
+ * obtain it through the world-wide-web, please send a note to
+ * license@php.net so we can mail you a copy immediately.
+ *
+ * @category Date
+ * @package Date_Holidays
+ * @author Martin Zdrahal <zdrahal@ipnp.mff.cuni.cz>
+ * @license http://www.php.net/license/3_01.txt PHP License 3.0.1
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/Date_Holidays
+ */
+
+/**
+ * Requires Christian driver
+ */
+require_once 'Date/Holidays/Driver/Christian.php';
+
+/**
+ * class that calculates Czech holidays
+ * basen on Austria.php file by Klemens Ullmann
+ * advent determination modified according to the correct rules
+ *
+ * @category Date
+ * @package Date_Holidays
+ * @subpackage Driver
+ * @author Martin Zdrahal <zdrahal@ipnp.mff.cuni.cz>
+ * @license http://www.php.net/license/3_01.txt PHP License 3.0.1
+ * @link http://pear.php.net/package/Date_Holidays
+ */
+class Date_Holidays_Driver_Czech extends Date_Holidays_Driver
+{
+ /**
+ * this driver's name
+ *
+ * @access protected
+ * @var string
+ */
+ var $_driverName = 'Czech';
+
+ /**
+ * Constructor
+ *
+ * Use the Date_Holidays::factory() method to construct an object of a certain
+ * driver
+ *
+ * @access protected
+ */
+ function Date_Holidays_Driver_Czech()
+ {
+ }
+
+ /**
+ * Build the internal arrays that contain data about the calculated holidays
+ *
+ * @access protected
+ * @return boolean true on success, otherwise a PEAR_ErrorStack object
+ * @throws object PEAR_ErrorStack
+ */
+ function _buildHolidays()
+ {
+ /**
+ * New Year's Day
+ */
+ $this->_addHoliday(
+ 'newYearsDay',
+ $this->_year . '-01-01',
+ 'Nový rok'
+ );
+
+ /**
+ * Restoration Day of the Independent Czech State
+ */
+ $this->_addHoliday(
+ 'IndependentCzechState',
+ $this->_year . '-01-01',
+ 'Den obnovy samostatného českého státu'
+ );
+
+ /**
+ * Epiphanias
+ */
+ $this->_addHoliday(
+ 'epiphany',
+ $this->_year . '-01-06',
+ 'Tři králové'
+ );
+
+ /**
+ * Valentine´s Day
+ */
+ $this->_addHoliday(
+ 'valentinesDay',
+ $this->_year . '-02-14',
+ 'Svatý Valentýn'
+ );
+
+ /**
+ * Easter Sunday
+ */
+ $easterDate = Date_Holidays_Driver_Christian::calcEaster($this->_year);
+ $this->_addHoliday(
+ 'easter',
+ $easterDate,
+ 'Velikonoční neděle'
+ );
+
+ /**
+ * Ash Wednesday
+ */
+ $ashWednesday = $this->_addDays($easterDate, -46);
+ $this->_addHoliday(
+ 'ashWednesday',
+ $ashWednesday,
+ 'Popeleční středa'
+ );
+
+ /**
+ * Palm Sunday
+ */
+ $palmSunday = $this->_addDays($easterDate, -7);
+ $this->_addHoliday(
+ 'palmSunday',
+ $palmSunday,
+ 'Květná neděle'
+ );
+
+ /**
+ * Maundy Thursday
+ */
+ $maundyThursday = $this->_addDays($easterDate, -3);
+ $this->_addHoliday(
+ 'maundyThursday',
+ $maundyThursday,
+ 'Zelený čtvrtek'
+ );
+
+ /**
+ * Good Friday
+ */
+ $goodFriday = $this->_addDays($easterDate, -2);
+ $this->_addHoliday(
+ 'goodFriday',
+ $goodFriday,
+ 'Velký pátek'
+ );
+
+ /**
+ * Easter Monday
+ */
+ $this->_addHoliday(
+ 'easterMonday',
+ $easterDate->getNextDay(),
+ 'Velikonoční pondělí'
+ );
+
+ /**
+ * Day of Work
+ */
+ $this->_addHoliday(
+ 'dayOfWork',
+ $this->_year . '-05-01',
+ 'Svátek práce'
+ );
+
+ /**
+ * Liberation Day
+ */
+ $this->_addHoliday(
+ 'libarationDay',
+ $this->_year . '-05-08',
+ 'Den vítězství'
+ );
+
+ /**
+ * Mothers Day
+ */
+ $mothersDay = $this->_calcFirstMonday("05");
+ $mothersDay = $mothersDay->getPrevDay();
+ $mothersDay = $this->_addDays($mothersDay, 7);
+ $this->_addHoliday(
+ 'mothersDay',
+ $mothersDay,
+ 'Den matek'
+ );
+
+ /**
+ * Ascension Day
+ */
+ $ascensionDate = $this->_addDays($easterDate, 39);
+ $this->_addHoliday(
+ 'ascensionDate',
+ $ascensionDate,
+ 'Nanebevstoupení Páně'
+ );
+
+ /**
+ * Whitsun (determines Whit Monday, Ascension Day and
+ * Feast of Corpus Christi)
+ */
+ $whitsunDate = $this->_addDays($easterDate, 49);
+ $this->_addHoliday(
+ 'whitsun',
+ $whitsunDate,
+ 'Svatodušní neděle'
+ );
+
+ /**
+ * Whit Monday
+ */
+ $this->_addHoliday(
+ 'whitMonday',
+ $whitsunDate->getNextDay(),
+ 'Svatodušní pondělí'
+ );
+
+ /**
+ * Corpus Christi
+ */
+ $corpusChristi = $this->_addDays($easterDate, 60);
+ $this->_addHoliday(
+ 'corpusChristi',
+ $corpusChristi,
+ 'Corpus Christi'
+ );
+
+ /**
+ * Saints Cyril and Methodius Day
+ */
+ $this->_addHoliday(
+ 'CyrilMethodius',
+ $this->_year . '-07-05',
+ 'Den slovanských věrozvěstů Cyrila a Metoděje'
+ );
+
+ /**
+ * Jan Hus Day
+ */
+ $this->_addHoliday(
+ 'HusDay',
+ $this->_year . '-07-06',
+ 'Den upálení mistra Jana Husa'
+ );
+
+
+ /**
+ * Ascension of Maria
+ */
+ $this->_addHoliday(
+ 'mariaAscension',
+ $this->_year . '-08-15',
+ 'Nanebevzetí panny Marie'
+ );
+
+ /**
+ * Czech Statehood Day
+ */
+ $this->_addHoliday(
+ 'WenceslasDay',
+ $this->_year . '-09-28',
+ 'Den české státnosti'
+ );
+
+ /**
+ * Independent Czechoslovak State Day
+ */
+ $this->_addHoliday(
+ 'nationalDayCzechoslovakia',
+ $this->_year . '-10-28',
+ 'Den vzniku samostatného československého státu'
+ );
+
+ /**
+ * All Saints' Day
+ */
+ $this->_addHoliday(
+ 'allSaintsDay',
+ $this->_year . '-11-01',
+ 'Svátek všech svatých'
+ );
+
+ /**
+ * All Souls´ Day
+ */
+ $this->_addHoliday(
+ 'allSoulsDay',
+ $this->_year . '-11-02',
+ 'Památka zesnulých'
+ );
+
+ /**
+ * Struggle for Freedom and Democracy Day
+ */
+ $this->_addHoliday(
+ 'FreedomDay',
+ $this->_year . '-11-17',
+ 'Den boje za svobodu a demokracii'
+ );
+
+ /**
+ * Veterans Day
+ */
+ $this->_addHoliday(
+ 'veteranDay',
+ $this->_year . '-11-11',
+ 'Den válečných veteránů'
+ );
+
+ /**
+ * Santa Claus
+ */
+ $this->_addHoliday(
+ 'santasDay',
+ $this->_year . '-12-06',
+ 'Svatý Mikuláš'
+ );
+
+ /**
+ * 1. Advent
+ */
+ $firstAdv = new Date($this->_year . '-12-03');
+ $dayOfWeek = $firstAdv->getDayOfWeek();
+ $firstAdv = $this->_addDays($firstAdv, -$dayOfWeek);
+ $this->_addHoliday(
+ 'firstAdvent',
+ $firstAdv,
+ '1. neděle adventní'
+ );
+
+ /**
+ * 2. Advent
+ */
+ $secondAdv = $this->_addDays($firstAdv, 7);
+ $this->_addHoliday(
+ 'secondAdvent',
+ $secondAdv,
+ '2. neděle adventní'
+ );
+
+ /**
+ * 3. Advent
+ */
+ $thirdAdv = $this->_addDays($firstAdv, 14);
+ $this->_addHoliday(
+ 'thirdAdvent',
+ $thirdAdv,
+ '3. neděle adventní'
+ );
+
+ /**
+ * 4. Advent
+ */
+ $fourthAdv = $this->_addDays($firstAdv, 21);
+ $this->_addHoliday(
+ 'fourthAdvent',
+ $fourthAdv,
+ '4. neděle adventní'
+ );
+
+ /**
+ * Christmas Eve
+ */
+ $this->_addHoliday(
+ 'christmasEve',
+ $this->_year . '-12-24',
+ 'Štědrý den'
+ );
+
+ /**
+ * Christmas day
+ */
+ $this->_addHoliday(
+ 'christmasDay',
+ $this->_year . '-12-25',
+ '1. svátek vánoční'
+ );
+
+ /**
+ * Boxing day
+ */
+ $this->_addHoliday(
+ 'boxingDay',
+ $this->_year . '-12-26',
+ '2. svátek vánoční'
+ );
+
+ /**
+ * New Year´s Eve
+ */
+ $this->_addHoliday(
+ 'newYearsEve',
+ $this->_year . '-12-31',
+ 'Silvestr'
+ );
+
+ if (Date_Holidays::errorsOccurred()) {
+ return Date_Holidays::getErrorStack();
+ }
+ return true;
+ }
+
+ /**
+ * Method that returns an array containing the ISO3166 codes that may possibly
+ * identify a driver.
+ *
+ * @static
+ * @access public
+ * @return array possible ISO3166 codes
+ */
+ function getISO3166Codes()
+ {
+ return array('cz');
+ }
+}
+?>
View
489 Date/Holidays/Driver/Russia.php
@@ -0,0 +1,489 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+/**
+ * Driver for determining holidays in Russia
+ *
+ * PHP Version 4 5
+ *
+ * Copyright (c) 2011 The PHP Group
+ *
+ * @category Date
+ * @package Date_Holidays
+ * @author Veronica Morales Marquez <veronica.morales.marquez@lut.fi>
+ * @author Poorang Vosough <poorang.vosough@lut.fi>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @version Russia.php v 0.0.4
+ * @link http://pear.php.net/package/Date_Holidays
+ */
+require_once 'Date/Calc.php';
+require_once 'Date/Holidays/Driver/Christian.php';
+
+/**
+ * Driver class that calculates Russia holidays
+ *
+ * @category Date
+ * @package Date_Holidays
+ * @author Veronica Morales Marquez <veronica.morales.marquez@lut.fi>
+ * @author Poorang Vosough <poorang.vosough@lut.fi>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @version Russia.php v 0.0.4
+ * @link http://pear.php.net/package/Date_Holidays
+ */
+class Date_Holidays_Driver_Russia extends Date_Holidays_Driver
+{
+ /**
+ * this driver's name
+ *
+ * @access protected
+ * @var string
+ */
+ var $_driverName = 'Russia';
+
+ /**
+ * Constructor
+ *
+ * Use the Date_Holidays::factory() method to construct an object of
+ * a certain driver
+ *
+ * @access protected
+ */
+ function Date_Holidays_Driver_Russia()
+ {
+ }
+
+ /**
+ * Build the internal arrays that contain data about the calculated holidays
+ *
+ * @access protected
+ * @return boolean true on success, otherwise a PEAR_ErrorStack object
+ * @throws object PEAR_ErrorStack
+ */
+ function _buildHolidays()
+ {
+ parent::_buildHolidays();
+
+ /**
+ * New Year's Day and Christmas
+ */
+ $newYearsDay1 = new Date($this->_year . '-01-01');
+ $this->_addHoliday('newYearsDay1', $newYearsDay1, 'New Year\'s Day');
+ if ($newYearsDay1->getDayOfWeek() == 0) { // 0 = Sunday
+ $this->_addHoliday(
+ 'newYearsDay2',
+ $this->_year . '-01-02',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay3',
+ $this->_year . '-01-03',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay4',
+ $this->_year . '-01-04',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay5',
+ $this->_year . '-01-05',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay6',
+ $this->_year . '-01-06',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'christmasDay',
+ $this->_year . '-01-07',
+ 'Christmas Day'
+ );
+ } elseif ($newYearsDay1->getDayOfWeek() == 1) { // 1 = Monday
+ $this->_addHoliday(
+ 'newYearsDay2',
+ $this->_year . '-01-02',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay3',
+ $this->_year . '-01-03',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay4',
+ $this->_year . '-01-04',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay5',
+ $this->_year . '-01-05',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'christmasDay',
+ $this->_year . '-01-07',
+ 'Christmas Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay6',
+ $this->_year . '-01-08',
+ 'New Year\'s Day'
+ );
+ } elseif ($newYearsDay1->getDayOfWeek() == 2) { // 2 = Tuesday
+ $this->_addHoliday(
+ 'newYearsDay2',
+ $this->_year . '-01-02',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay3',
+ $this->_year . '-01-03',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay4',
+ $this->_year . '-01-04',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'christmasDay',
+ $this->_year . '-01-07',
+ 'Christmas Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay5',
+ $this->_year . '-01-08',
+ 'New Year\'s Day'
+ );
+ } elseif ($newYearsDay1->getDayOfWeek() == 3) { // 3 = Wednesday
+ $this->_addHoliday(
+ 'newYearsDay2',
+ $this->_year . '-01-02',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay3',
+ $this->_year . '-01-03',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay4',
+ $this->_year . '-01-06',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'christmasDay',
+ $this->_year . '-01-07',
+ 'Christmas Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay5',
+ $this->_year . '-01-08',
+ 'New Year\'s Day'
+ );
+ } elseif ($newYearsDay1->getDayOfWeek() == 4) { // 4 = Thursday
+ $this->_addHoliday(
+ 'newYearsDay2',
+ $this->_year . '-01-02',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay3',
+ $this->_year . '-01-05',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay4',
+ $this->_year . '-01-06',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'christmasDay',
+ $this->_year . '-01-07',
+ 'Christmas Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay5',
+ $this->_year . '-01-08',
+ 'New Year\'s Day'
+ );
+ } elseif ($newYearsDay1->getDayOfWeek() == 5) { // 5 = Friday
+ $this->_addHoliday(
+ 'newYearsDay2',
+ $this->_year . '-01-04',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay3',
+ $this->_year . '-01-05',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay4',
+ $this->_year . '-01-06',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'christmasDay',
+ $this->_year . '-01-07',
+ 'Christmas Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay5',
+ $this->_year . '-01-08',
+ 'New Year\'s Day'
+ );
+ } elseif ($newYearsDay1->getDayOfWeek() == 6) { // 6 = Saturday
+ $this->_addHoliday(
+ 'newYearsDay2',
+ $this->_year . '-03-03',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay3',
+ $this->_year . '-01-04',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay4',
+ $this->_year . '-01-05',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay5',
+ $this->_year . '-01-06',
+ 'New Year\'s Day'
+ );
+ $this->_addHoliday(
+ 'christmasDay',
+ $this->_year . '-01-07',
+ 'Christmas Day'
+ );
+ $this->_addHoliday(
+ 'newYearsDay6',
+ $this->_year . '-01-08',
+ 'New Year\'s Day'
+ );
+ }
+
+ /**
+ * International Women's Day
+ */
+ $womensDay = new Date($this->_year . '-03-08');
+ /*bridge and moving holidays*/
+ if ($womensDay->getDayOfWeek() == 2) { // 2 = Tuesday
+ $this->_addHoliday(
+ 'womensDay1',
+ $this->_year . '-03-07',
+ 'International Women\'s Day'
+ );
+ $this->_addHoliday(
+ 'womensDay2',
+ $this->_year . '-03-08',
+ 'International Women\'s Day'
+ );
+ } elseif ($womensDay->getDayOfWeek() == 4) { // 4 = Thursday
+ $this->_addHoliday(
+ 'womensDay1',
+ $this->_year . '-03-08',
+ 'International Women\'s Day'
+ );
+ $this->_addHoliday(
+ 'womensDay2',
+ $this->_year . '-03-09',
+ 'International Women\'s Day'
+ );
+ } else {
+ if ($womensDay->getDayOfWeek() == 6) { // 6=Saturday
+ $womensDay = $this->_year . '-03-10';
+ } elseif ($womensDay->getDayOfWeek() == 0) { // 0=Sunday
+ $womensDay = $this->_year . '-03-09';
+ }
+ $this->_addHoliday(
+ 'womensDay',
+ $womensDay,
+ 'International Women\'s Day'
+ );
+ }
+
+ /**
+ * Defender of the Fatherland Day
+ */
+ $defenderFatherlandDay = new Date($this->_year . '-02-23');
+ /*bridge and moving holidays*/
+ if ($defenderFatherlandDay->getDayOfWeek() == 2) { // 2 = Tuesday
+ $this->_addHoliday(
+ 'defenderFatherlandDay1',
+ $this->_year . '-02-22',
+ 'Defender of the Fatherland Day'
+ );
+ $this->_addHoliday(
+ 'defenderFatherlandDay2',
+ $this->_year . '-02-23',
+ 'Defender of the Fatherland Day'
+ );
+ } elseif ($defenderFatherlandDay->getDayOfWeek() == 4) { // 4 = Thursday
+ $this->_addHoliday(
+ 'defenderFatherlandDay1',
+ $this->_year . '-02-23',
+ 'Defender of the Fatherland Day'
+ );
+ $this->_addHoliday(
+ 'defenderFatherlandDay2',
+ $this->_year . '-02-24',
+ 'Defender of the Fatherland Day'
+ );
+ } else {
+ if ($defenderFatherlandDay->getDayOfWeek() == 6) { // 6=Saturday
+ $defenderFatherlandDay = $this->_year . '-02-25';
+
+ } elseif ($defenderFatherlandDay->getDayOfWeek() == 0) { // 0=Sunday
+ $defenderFatherlandDay = $this->_year . '-02-24';
+ }
+ $this->_addHoliday(
+ 'defenderFatherlandDay',
+ $defenderFatherlandDay,
+ 'Defender of the Fatherland Day'
+ );
+ }
+
+ /**
+ * Spring and Labour Day
+ */
+ $springLabourDay = new Date($this->_year . '-05-01');
+ /*bridge and moving holidays*/
+ if ($springLabourDay->getDayOfWeek() == 2) { // 2 = Tuesday
+ $this->_addHoliday(
+ 'springLabourDay1',
+ $this->_year . '-04-30',
+ 'Spring and Labour Day'
+ );
+ $this->_addHoliday(
+ 'springLabourDay2',
+ $this->_year . '-05-01',
+ 'Spring and Labour Day'
+ );
+ } elseif ($springLabourDay->getDayOfWeek() == 4) { // 4 = Thursday
+ $this->_addHoliday(
+ 'springLabourDay1',
+ $this->_year . '-05-01',
+ 'Spring and Labour Day'
+ );
+ $this->_addHoliday(
+ 'springLabourDay2',
+ $this->_year . '-05-02',
+ 'Spring and Labour Day'
+ );
+ } else {
+ if ($springLabourDay->getDayOfWeek() == 6) { // 6=Saturday
+ $springLabourDay = $this->_year . '-05-03';
+
+ } elseif ($springLabourDay->getDayOfWeek() == 0) { // 0=Sunday
+ $springLabourDay = $this->_year . '-05-02';
+ }
+ $this->_addHoliday(
+ 'springLabourDay',
+ $springLabourDay,
+ 'Spring and Labour Day'
+ );
+ }
+
+ /**
+ * Victory Day
+ */
+ $victoryDay = new Date($this->_year . '-05-09');
+ /*bridge and moving holidays*/
+ if ($victoryDay->getDayOfWeek() == 2) { // 2 = Tuesday
+ $this->_addHoliday(
+ 'victoryDay1',
+ $this->_year . '-05-08',
+ 'Victory Day'
+ );
+ $this->_addHoliday(
+ 'victoryDay2',
+ $this->_year . '-05-09',
+ 'Victory Day'
+ );
+ } elseif ($victoryDay->getDayOfWeek() == 4) { // 4 = Thursday
+ $this->_addHoliday(
+ 'victoryDay1',
+ $this->_year . '-05-09',
+ 'Victory Day'
+ );
+ $this->_addHoliday(
+ 'victoryDay2',
+ $this->_year . '-05-10',
+ 'Victory Day'
+ );
+ } else {
+ if ($victoryDay->getDayOfWeek() == 6) { // 6=Saturday
+ $victoryDay = $this->_year . '-05-11';
+
+ } elseif ($victoryDay->getDayOfWeek() == 0) { // 0=Sunday
+ $victoryDay = $this->_year . '-05-10';
+ }
+ $this->_addHoliday('victoryDay', $victoryDay, 'Victory Day');
+ }
+
+ /**
+ * Russia Day
+ */
+ $russiaDay = new Date($this->_year . '-06-12');
+ /*bridge and moving holidays*/
+ if ($russiaDay->getDayOfWeek() == 2) { // 2 = Tuesday
+ $this->_addHoliday('russiaDay1', $this->_year . '-06-11', 'Russia Day');
+ $this->_addHoliday('russiaDay2', $this->_year . '-06-12', 'Russia Day');
+ } elseif ($russiaDay->getDayOfWeek() == 4) { // 4 = Thursday
+ $this->_addHoliday('russiaDay1', $this->_year . '-06-12', 'Russia Day');
+ $this->_addHoliday('russiaDay2', $this->_year . '-06-13', 'Russia Day');
+ } else {
+ if ( $russiaDay->getDayOfWeek() == 6) { // 6=Saturday
+ $russiaDay = $this->_year . '-06-14';
+
+ } elseif ($russiaDay->getDayOfWeek() == 0) { // 0=Sunday
+ $russiaDay = $this->_year . '-06-13';
+ }
+ $this->_addHoliday('russiaDay', $russiaDay, 'Russia Day');
+ }
+
+ /**
+ * Unity Day
+ */
+ $unityDay = new Date($this->_year . '-11-04');
+ /*bridge and moving holidays*/
+ if ($unityDay->getDayOfWeek() == 2) { // 2 = Tuesday
+ $this->_addHoliday('unityDay1', $this->_year . '-11-03', 'Unity Day');
+ $this->_addHoliday('unityDay2', $this->_year . '-11-04', 'Unity Day');
+ } elseif ($unityDay->getDayOfWeek() == 4) { // 4 = Thursday
+ $this->_addHoliday('unityDay1', $this->_year . '-11-04', 'Unity Day');
+ $this->_addHoliday('unityDay2', $this->_year . '-11-05', 'Unity Day');
+ } else {
+ if ($unityDay->getDayOfWeek() == 6) { // 6=Saturday
+ $unityDay = $this->_year . '-11-06';
+
+ } elseif ($unityDay->getDayOfWeek() == 0) { // 0=Sunday
+ $unityDay = $this->_year . '-11-05';
+ }
+ $this->_addHoliday('unityDay', $unityDay, 'Unity Day');
+ }
+
+ if (Date_Holidays::errorsOccurred()) {
+ return Date_Holidays::getErrorStack();
+ }
+ return true;
+ }
+
+ /**
+ * Method that returns an array containing the ISO3166 codes that may possibly
+ * identify a driver.
+ *
+ * @static
+ * @access public
+ * @return array possible ISO3166 codes
+ */
+ function getISO3166Codes()
+ {
+ return array('ru', 'RU');
+ }
+}
+?>
View
190 Date/Holidays/Driver/Serbia.php
@@ -0,0 +1,190 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+/**
+ * Serbia
+ *
+ * PHP Version 4
+ *
+ * Copyright (c) 1997-2008 The PHP Group
+ *
+ * This source file is subject to version 3.0 of the PHP license,
+ * that is bundled with this package in the file LICENSE, and is
+ * available at through the world-wide-web at
+ * http://www.php.net/license/3_01.txt.
+ * If you did not receive a copy of the PHP license and are unable to
+ * obtain it through the world-wide-web, please send a note to
+ * license@php.net so we can mail you a copy immediately.
+ *
+ * @category Date
+ * @package Date_Holidays
+ * @author Boban Acimovic <boban.acimovic@gmail.com>
+ * @license http://www.php.net/license/3_01.txt PHP License 3.0.1
+ * @version 0.1
+ * @link http://pear.php.net/package/Date_Holidays
+ */
+
+/**
+ * Driver class that calculates Serbian holidays
+ *
+ * @category Date
+ * @package Date_Holidays
+ * @subpackage Driver
+ * @author Boban Acimovic <boban.acimovic@gmail.com>
+ * @license http://www.php.net/license/3_01.txt PHP License 3.0.1
+ * @version 0.1
+ * @link http://pear.php.net/package/Date_Holidays
+ */
+class Date_Holidays_Driver_Serbia extends Date_Holidays_Driver
+{
+ /**
+ * Constructor
+ *
+ * Use the Date_Holidays::factory() method to construct an object of
+ * a certain driver
+ *
+ * @access protected
+ */
+ function Date_Holidays_Driver_Serbia()
+ {
+ }
+
+ /**
+ * Build the internal arrays that contain data about the calculated holidays
+ *
+ * @access protected
+ * @return boolean true on success, otherwise a PEAR_ErrorStack object
+ * @throws object PEAR_ErrorStack
+ */
+ function _buildHolidays()
+ {
+ /**
+ * Nova godina
+ */
+ $this->_addHoliday('novagodina', $this->_year . '-01-01', 'Nova godina');
+
+ /**
+ * Božić - Rođenje Gospoda Isusa Hrista
+ */
+ $this->_addHoliday('bozic', $this->_year . '-01-07', 'Božić - Rođenje Gospoda Isusa Hrista');
+
+ /**
+ * Sretenje - Dan državnosti Srbije
+ */
+ $this->_addHoliday('sretenje', $this->_year . '-01-15', 'Sretenje - Dan državnosti Srbije');
+
+ /**
+ * Veliki petak
+ */
+ $this->_addHoliday('velikipetak', $this->_year . $this->_getGoodFriday(), 'Veliki petak');
+
+ /**
+ * Vaskrs
+ */
+ $this->_addHoliday('vaskrs', $this->_year . $this->_getEaster(), 'Vaskrsenje Gospoda Isusa Hrista');
+
+ /**
+ * Praznik rada
+ */
+ $this->_addHoliday('praznikrada', $this->_year . '-05-01', 'Praznik rada');
+
+ /**
+ * Dan primirja u Prvom svetskom ratu
+ */
+ $this->_addHoliday('danprimirja', $this->_year . '-11-11', 'Dan primirja u Prvom svetskom ratu');
+
+ if (Date_Holidays::errorsOccurred()) {
+ return Date_Holidays::getErrorStack();
+ }
+ return true;
+ }
+
+ /**
+ * Helper method that Calculates Orthodox Easter date in Julian calendar
+ * Meeus Julian algorithm
+ *
+ * @static
+ * @access private
+ * @return string
+ */
+ function _calcEaster()
+ {
+ $a = $this->_year % 4;
+ $b = $this->_year % 7;
+ $c = $this->_year % 19;
+ $d = (19 * $c + 15) % 30;
+ $e = (2 * $a + 4 * $b - $d + 34) % 7;
+ $month = floor(($d + $e + 114) / 31);
+ $day = (($d + $e + 114) % 31) + 1;
+ return array($month, $day);
+ }
+
+ /**
+ * Helper method that returns formatted Orthodox Easter date
+ *
+ * @static
+ * @access private
+ * @return string
+ */
+ function _getEaster()
+ {
+ list($month, $day) = $this->_calcEaster();
+ // Add 13 days to convert from Julian to Gregorian calendar
+ $day += 13;
+ if ($day > 30) {
+ if ($month == 5) {
+ $day -= 31;
+ }
+ if ($month == 4) {
+ $day -= 30;
+ }
+ $month++;
+ }
+ // Format numbers
+ $month = sprintf( '%02d', $month);
+ $day = sprintf( '%02d', $day);
+ return "-$month-$day";
+ }
+
+ /**
+ * Helper method that returns formatted Orthodox Good Friday date
+ *
+ * @static
+ * @access private
+ * @return string
+ */
+ function _getGoodFriday()
+ {
+ list($month, $day) = $this->_calcEaster();
+ // Add 13 days to convert from Julian to Gregorian calendar
+ $day += 13;
+ // Remove 2 days to get Good Friday intead of Easter
+ $day -= 2;
+ if ($day > 30) {
+ if ($month == 5) {
+ $day -= 31;
+ }
+ if ($month == 4) {
+ $day -= 30;
+ }
+ $month++;
+ }
+ // Format numbers
+ $month = sprintf( '%02d', $month);
+ $day = sprintf( '%02d', $day);
+ return "-$month-$day";
+ }
+
+ /**
+ * Method that returns an array containing the ISO3166 codes that may possibly
+ * identify a driver.
+ *
+ * @static
+ * @access public
+ * @return array possible ISO3166 codes
+ */
+ function getISO3166Codes()
+ {
+ return array('rs', 'srb');
+ }
+}
+?>
View
77 Date/Holidays/Filter/Czech/Official.php
@@ -0,0 +1,77 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+/**
+ * Filter for Official holidays in Czech Republic.
+ *
+ * PHP Version 4
+ *
+ * Copyright (c) 1997-2008 The PHP Group
+ *
+ * This source file is subject to version 3.0 of the PHP license,
+ * that is bundled with this package in the file LICENSE, and is
+ * available at through the world-wide-web at
+ * http://www.php.net/license/3_01.txt.
+ * If you did not receive a copy of the PHP license and are unable to
+ * obtain it through the world-wide-web, please send a note to
+ * license@php.net so we can mail you a copy immediately.
+ *
+ * @category Date
+ * @package Date_Holidays
+ * @author Martin Zdrahal <zdrahal@ipnp.mff.cuni.cz>
+ * @license http://www.php.net/license/3_01.txt PHP License 3.0.1
+ * @version CVS: $Id$
+ * @link http://pear.php.net/package/Date_Holidays
+ */
+
+/**
+ * Filter that only accepts official holidays of the Czech Republic.
+ * By Martin Zdrahal; based on Austria/Official.php by Karin Seifert-Lorenz.
+ *
+ * @category Date
+ * @package Date_Holidays
+ * @subpackage Filter
+ * @author Martin Zdrahal <zdrahal@ipnp.mff.cuni.cz>
+ * @license http://www.php.net/license/3_01.txt PHP License 3.0.1
+ * @link http://pear.php.net/package/Date_Holidays
+ */
+class Date_Holidays_Filter_Czech_Official extends Date_Holidays_Filter_Whitelist
+{
+ /**
+ * Constructor.
+ *
+ */
+ function __construct()
+ {
+ parent::__construct(
+ array(
+ 'newYearsDay',
+ 'IndependentCzechState',
+ 'easterMonday',
+ 'dayOfWork',
+ 'liberationDay',
+ 'CyrilMethodius',
+ 'HusDay',
+ 'WenceslasDay',
+ 'nationalDayCzechoslovakia',
+ 'FreedomDay',
+ 'christmasEve',
+ 'christmasDay',
+ 'boxingDay'
+ )
+ );
+ }
+
+ /**
+ * Constructor.
+ *
+ * Only accepts official public holidays of the Czech Republic as described on
+ * http://www.mpsv.cz/cs/74
+ *
+ * @link http://www.mpsv.cz/cs/74
+ */
+ function Date_Holidays_Filter_Czech_Official()
+ {
+ $this->__construct();
+ }
+}
+?>
View
131 package.xml
@@ -28,10 +28,10 @@
<email>wiesemann@php.net</email>
<active>no</active>
</contributor>
- <date>2012-11-25</date>
+ <date>2013-01-22</date>
<time>00:11:16</time>
<version>
- <release>0.21.7</release>
+ <release>0.21.8</release>
<api>0.17.2</api>
</version>
<stability>
@@ -40,7 +40,7 @@
</stability>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
-* Request #19716: Add Dutch translation for Christian driver
+* New drivers.
</notes>
<contents>
<dir baseinstalldir="/" name="/">
@@ -141,6 +141,12 @@
<channel>pear.php.net</channel>
</package>
</optional>
+ <group hint="Australia subpackage" name="Date_Holidays_Australia">
+ <package>
+ <name>Date_Holidays_Australia</name>
+ <channel>pear.php.net</channel>
+ </package>
+ </group>
<group hint="Austria subpackage" name="Date_Holidays_Austria">
<package>
<name>Date_Holidays_Austria</name>
@@ -153,6 +159,18 @@
<channel>pear.php.net</channel>
</package>
</group>
+ <group hint="Croatia subpackage" name="Date_Holidays_Croatia">
+ <package>
+ <name>Date_Holidays_Croatia</name>
+ <channel>pear.php.net</channel>
+ </package>
+ </group>
+ <group hint="Czech subpackage" name="Date_Holidays_Czech">
+ <package>
+ <name>Date_Holidays_Czech</name>
+ <channel>pear.php.net</channel>
+ </package>
+ </group>
<group hint="Denmark subpackage" name="Date_Holidays_Denmark">
<package>
<name>Date_Holidays_Denmark</name>
@@ -171,6 +189,12 @@
<channel>pear.php.net</channel>
</package>
</group>
+ <group hint="Finland subpackage" name="Date_Holidays_Finland">
+ <package>
+ <name>Date_Holidays_Finland</name>
+ <channel>pear.php.net</channel>
+ </package>
+ </group>
<group hint="Germany subpackage" name="Date_Holidays_Germany">
<package>
<name>Date_Holidays_Germany</name>
@@ -219,24 +243,60 @@
<channel>pear.php.net</channel>
</package>
</group>
+ <group hint="Portugal subpackage" name="Date_Holidays_Portugal">
+ <package>
+ <name>Date_Holidays_Portugal</name>
+ <channel>pear.php.net</channel>
+ </package>
+ </group>
<group hint="Romania subpackage" name="Date_Holidays_Romania">
<package>
<name>Date_Holidays_Romania</name>
<channel>pear.php.net</channel>
</package>
</group>
+ <group hint="Russia subpackage" name="Date_Holidays_Russia">
+ <package>
+ <name>Date_Holidays_Russia</name>
+ <channel>pear.php.net</channel>
+ </package>
+ </group>
+ <group hint="SanMarino subpackage" name="Date_Holidays_SanMarino">
+ <package>
+ <name>Date_Holidays_SanMarino</name>
+ <channel>pear.php.net</channel>
+ </package>
+ </group>
+ <group hint="Serbia subpackage" name="Date_Holidays_Serbia">
+ <package>
+ <name>Date_Holidays_Serbia</name>
+ <channel>pear.php.net</channel>
+ </package>
+ </group>
<group hint="Slovenia subpackage" name="Date_Holidays_Slovenia">
<package>
<name>Date_Holidays_Slovenia</name>
<channel>pear.php.net</channel>
</package>
</group>
+ <group hint="Spain subpackage" name="Date_Holidays_Spain">
+ <package>
+ <name>Date_Holidays_Spain</name>
+ <channel>pear.php.net</channel>
+ </package>
+ </group>
<group hint="Sweden subpackage" name="Date_Holidays_Sweden">
<package>
<name>Date_Holidays_Sweden</name>
<channel>pear.php.net</channel>
</package>
</group>
+ <group hint="Turkey subpackage" name="Date_Holidays_Turkey">
+ <package>
+ <name>Date_Holidays_Turkey</name>
+ <channel>pear.php.net</channel>
+ </package>
+ </group>
<group hint="Ukraine subpackage" name="Date_Holidays_Ukraine">
<package>
<name>Date_Holidays_Ukraine</name>
@@ -255,8 +315,18 @@
<channel>pear.php.net</channel>
</package>
</group>
+ <group hint="Venezuela subpackage" name="Date_Holidays_Venezuela">
+ <package>
+ <name>Date_Holidays_Venezuela</name>
+ <channel>pear.php.net</channel>
+ </package>
+ </group>
<group hint="all subpackages (for bulk install and uninstall)" name="all">
<package>
+ <name>Date_Holidays_Australia</name>
+ <channel>pear.php.net</channel>
+ </package>
+ <package>
<name>Date_Holidays_Austria</name>
<channel>pear.php.net</channel>
</package>
@@ -265,6 +335,14 @@
<channel>pear.php.net</channel>
</package>
<package>
+ <name>Date_Holidays_Croatia</name>
+ <channel>pear.php.net</channel>
+ </package>
+ <package>
+ <name>Date_Holidays_Czech</name>
+ <channel>pear.php.net</channel>
+ </package>
+ <package>
<name>Date_Holidays_Denmark</name>
<channel>pear.php.net</channel>
</package>
@@ -277,6 +355,10 @@
<channel>pear.php.net</channel>
</package>
<package>
+ <name>Date_Holidays_Finland</name>
+ <channel>pear.php.net</channel>
+ </package>
+ <package>
<name>Date_Holidays_Germany</name>
<channel>pear.php.net</channel>
</package>
@@ -309,18 +391,42 @@
<channel>pear.php.net</channel>
</package>
<package>
+ <name>Date_Holidays_Portugal</name>
+ <channel>pear.php.net</channel>
+ </package>
+ <package>
<name>Date_Holidays_Romania</name>
<channel>pear.php.net</channel>
</package>
<package>
+ <name>Date_Holidays_Russia</name>
+ <channel>pear.php.net</channel>
+ </package>
+ <package>
+ <name>Date_Holidays_SanMarino</name>
+ <channel>pear.php.net</channel>
+ </package>
+ <package>
+ <name>Date_Holidays_Serbia</name>
+ <channel>pear.php.net</channel>
+ </package>
+ <package>
<name>Date_Holidays_Slovenia</name>
<channel>pear.php.net</channel>
</package>
<package>
+ <name>Date_Holidays_Spain</name>
+ <channel>pear.php.net</channel>
+ </package>
+ <package>
<name>Date_Holidays_Sweden</name>
<channel>pear.php.net</channel>
</package>
<package>
+ <name>Date_Holidays_Turkey</name>
+ <channel>pear.php.net</channel>
+ </package>
+ <package>
<name>Date_Holidays_Ukraine</name>
<channel>pear.php.net</channel>
</package>
@@ -332,6 +438,10 @@
<name>Date_Holidays_USA</name>
<channel>pear.php.net</channel>
</package>
+ <package>
+ <name>Date_Holidays_Venezuela</name>
+ <channel>pear.php.net</channel>
+ </package>
</group>
</dependencies>
<phprelease />
@@ -704,5 +814,20 @@ Added driver and English languagefile for USA built by Kevin English.
* Fix Bug #19151: Easter Monday is always on the next day
</notes>
</release>
+ <release>
+ <version>
+ <release>0.21.7</release>
+ <api>0.17.2</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <date>2012-11-25</date>
+ <license uri="http://www.php.net/license">PHP License</license>
+ <notes>
+* Request #19716: Add Dutch translation for Christian driver
+ </notes>
+ </release>
</changelog>
</package>
View
83 package_czech.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0"?>
+<package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0"
+ xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
+http://pear.php.net/dtd/tasks-1.0.xsd
+http://pear.php.net/dtd/package-2.0
+http://pear.php.net/dtd/package-2.0.xsd">
+ <name>Date_Holidays_Czech</name>
+ <channel>pear.php.net</channel>
+ <summary>Driver based class to calculate holidays in the Czech Republic.</summary>
+ <description>
+ Date_Holidays helps you calculate the dates and titles of
+ holidays and other special celebrations.
+ This is the driver for calculating holidays in the Czech Republic - thanks
+ to Martin Zdrahal.
+ </description>
+ <lead>
+ <name>Ken Guest</name>
+ <user>kguest</user>
+ <email>ken@linux.ie</email>
+ <active>yes</active>
+ </lead>
+ <date>2013-01-22</date>
+ <time>00:01:19</time>
+ <version>
+ <release>0.1.0</release>
+ <api>1.4.0</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <license uri="http://www.php.net/license/">PHP License</license>
+ <notes>Initial release</notes>
+ <contents>
+ <dir baseinstalldir="/" name="/">
+ <dir name="Date">
+ <dir name="Holidays">
+ <dir name="Driver">
+ <file name="Czech.php" role="php" />
+ </dir>
+ <dir name="Filter">
+ <dir name="Czech">
+ <file name="Official.php" role="php" />
+ </dir>
+ </dir>
+ </dir>
+ </dir>
+ </dir>
+ </contents>
+ <dependencies>
+ <required>
+ <php>
+ <min>4.0.0</min>
+ </php>
+ <pearinstaller>
+ <min>1.7.1</min>
+ </pearinstaller>
+ <package>
+ <name>Date_Holidays</name>
+ <channel>pear.php.net</channel>
+ <min>0.21.4</min>
+ </package>
+ </required>
+ </dependencies>
+ <phprelease />
+ <changelog>
+ <release>
+ <version>
+ <release>0.1.0</release>
+ <api>0.17.2</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <date>2013-01-22</date>
+ <license uri="http://www.php.net/license">PHP License</license>
+ <notes>initial PEAR release</notes>
+ </release>
+ </changelog>
+</package>
View
86 package_russia.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0"?>
+<package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0"
+ xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
+http://pear.php.net/dtd/tasks-1.0.xsd
+http://pear.php.net/dtd/package-2.0
+http://pear.php.net/dtd/package-2.0.xsd">
+ <name>Date_Holidays_Russia</name>
+ <channel>pear.php.net</channel>
+ <summary>Driver based class to calculate holidays in Russia.</summary>
+ <description>
+ Date_Holidays helps you calculate the dates and titles of
+ holidays and other special celebrations.
+ This is the driver for calculating holidays in Russia.
+ </description>
+ <lead>
+ <name>Ken Guest</name>
+ <user>kguest</user>
+ <email>ken@linux.ie</email>
+ <active>yes</active>
+ </lead>
+ <developer>
+ <name>Boban Acimovic</name>
+ <user>acim</user>
+ <email>boban.acimovic@gmail.com</email>
+ <active>yes</active>
+ </developer>
+ <date>2013-01-22</date>
+ <time>00:01:19</time>
+ <version>
+ <release>0.1.0</release>
+ <api>1.4.0</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <license uri="http://www.php.net/license/">PHP License</license>
+ <notes>Initial release</notes>
+ <contents>
+ <dir baseinstalldir="/" name="/">
+ <dir name="Date">
+ <dir name="Holidays">
+ <dir name="Driver">
+ <file name="Russia.php" role="php" />
+ </dir>
+ </dir>
+ </dir>
+ <dir name="tests">
+ <file name="Date_Holidays_Driver_Russia_TestSuite.php" role="test" />
+ </dir>
+ </dir>
+ </contents>
+ <dependencies>
+ <required>
+ <php>
+ <min>4.0.0</min>
+ </php>
+ <pearinstaller>
+ <min>1.7.1</min>
+ </pearinstaller>
+ <package>
+ <name>Date_Holidays</name>
+ <channel>pear.php.net</channel>
+ <min>0.21.4</min>
+ </package>
+ </required>
+ </dependencies>
+ <phprelease />
+ <changelog>
+ <release>
+ <version>
+ <release>0.1.0</release>
+ <api>0.17.2</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <date>2013-01-22</date>
+ <license uri="http://www.php.net/license">PHP License</license>
+ <notes>initial PEAR release</notes>
+ </release>
+ </changelog>
+</package>
View
86 package_serbia.xml
@@ -0,0 +1,86 @@
+<?xml version="1.0"?>
+<package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0"
+ xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
+http://pear.php.net/dtd/tasks-1.0.xsd
+http://pear.php.net/dtd/package-2.0
+http://pear.php.net/dtd/package-2.0.xsd">
+ <name>Date_Holidays_Serbia</name>
+ <channel>pear.php.net</channel>
+ <summary>Driver based class to calculate holidays in Serbia.</summary>
+ <description>
+ Date_Holidays helps you calculate the dates and titles of
+ holidays and other special celebrations.
+ This is the driver for calculating holidays in Serbia.
+ </description>
+ <lead>
+ <name>Boban Acimovic</name>
+ <user>acim</user>
+ <email>boban.acimovic@gmail.com</email>
+ <active>yes</active>
+ </lead>
+ <lead>
+ <name>Ken Guest</name>
+ <user>kguest</user>
+ <email>ken@linux.ie</email>
+ <active>yes</active>
+ </lead>
+ <date>2012-12-22</date>
+ <time>00:04:19</time>
+ <version>
+ <release>0.1.0</release>
+ <api>1.4.0</api>
+ </version>
+ <stability>
+ <release>beta</release>
+ <api>beta</api>
+ </stability>
+ <license uri="http://www.php.net/license/">PHP License</license>
+ <notes>Initial release</notes>
+ <contents>
+ <dir baseinstalldir="/" name="/">
+ <dir name="Date">
+ <dir name="Holidays">
+ <dir name="Driver">
+ <file name="Serbia.php" role="php" />
+ </dir>
+ </dir>
+ </dir>
+ <dir name="tests">
+ <file name="Date_Holidays_Driver_Serbia_TestSuite.php" role="test" />
+ </dir>
+ </dir>
+ </contents>
+ <dependencies>
+ <required>
+ <php>
+ <min>4.0.0</min>
+ </php>
+ <pearinstaller>
+ <min>1.7.1</min>
+ </pearinstaller>
+ <package>
+ <name>Date_Holidays</name>
+ <channel>pear.php.net</channel>
+ <min>0.21.4</min>
+ </package>
+ </required>
+ </dependencies>
+ <phprelease />
+ <changelog>
+ <release>
+ <version>
+ <release>0.1.0</release>
+ <api>0.17.2</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <date>2013-01-22</date>
+ <license uri="http://www.php.net/license">PHP License</license>
+ <notes>initial PEAR release</notes>
+ </release>
+ </changelog>
+</package>
View
207 tests/Date_Holidays_Driver_Russia_TestSuite.php
@@ -0,0 +1,207 @@
+<?php
+/**
+ * Test class for running unit tests related to the driver for holidays in Russia
+ *
+ * PHP Versions 4 and 5
+ *
+ * @category Date
+ * @package Date_Holidays
+ * @author Veronica Morales Marquez <veronica.morales.marquez@lut.fi>
+ * @author Poorang Vosough <poorang.vosough@lut.fi>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @version Russia.php v 0.0.4
+ * @link http://pear.php.net/package/Date_Holidays
+ */
+if (!defined("PHPUnit_MAIN_METHOD")) {
+ define("PHPUnit_MAIN_METHOD", "Date_HolidaysTest::main");
+}
+
+require_once 'Date/Holidays.php';
+
+define('LANG_FILE', '@DATA-DIR@/Date_Holidays_Russia/lang/');
+
+/**
+ * Test class for running unit tests related to the driver for holidays in Russia
+ *
+ * @uses PHPUnit_Framework_TestCase
+ * @category Date
+ * @package Date_Holidays
+ * @author Veronica Morales Marquez <veronica.morales.marquez@lut.fi>
+ * @author Poorang Vosough <poorang.vosough@lut.fi>
+ * @license BSD http://www.opensource.org/licenses/bsd-license.php
+ * @version Russia.php v 0.0.4
+ * @link http://pear.php.net/package/Date_Holidays
+ */
+class Date_Holidays_Driver_Russia_TestSuite extends PHPUnit_Framework_TestCase
+{
+
+
+ var $testDates2012 = array(
+ 'newYearsDay1' => array('day'=>1,
+ 'month'=>1,
+ 'year'=>2012),
+ 'newYearsDay2' => array('day'=>2,
+ 'month'=>1,
+ 'year'=>2012),
+ 'newYearsDay3' => array('day'=>3,
+ 'month'=>1,
+ 'year'=>2012),
+ 'newYearsDay4' => array('day'=>4,
+ 'month'=>1,
+ 'year'=>2012),
+ 'newYearsDay5' => array('day'=>5,
+ 'month'=>1,
+ 'year'=>2012),
+ 'newYearsDay6' => array('day'=>6,
+ 'month'=>1,
+ 'year'=>2012),
+ 'christmasDay' => array('day'=>7,
+ 'month'=>1,
+ 'year'=>2012),
+ 'defenderFatherlandDay1' => array('day'=>23,
+ 'month'=>2,
+ 'year'=>2012),
+ 'defenderFatherlandDay2' => array('day'=>24,
+ 'month'=>2,
+ 'year'=>2012),
+ 'womensDay1' => array('day'=>8,
+ 'month'=>3,
+ 'year'=>2012),
+ 'womensDay2' => array('day'=>9,
+ 'month'=>3,
+ 'year'=>2012),
+ 'springLabourDay1' => array('day'=>30,
+ 'month'=>4,
+ 'year'=>2012),
+ 'springLabourDay2' => array('day'=>1,
+ 'month'=>5,
+ 'year'=>2012),
+ 'victoryDay' => array('day'=>9,
+ 'month'=>5,
+ 'year'=>2012),
+ 'russiaDay1' => array('day'=>11,
+ 'month'=>6,
+ 'year'=>2012),
+ 'russiaDay2' => array('day'=>12,
+ 'month'=>6,
+ 'year'=>2012),
+ 'unityDay' => array('day'=>5,
+ 'month'=>11,
+ 'year'=>2012),
+
+
+
+ );
+
+ var $testDates2013 = array(
+ 'newYearsDay1' => array('day'=>1,
+ 'month'=>1,
+ 'year'=>2013),
+ 'newYearsDay2' => array('day'=>2,
+ 'month'=>1,
+ 'year'=>2013),
+ 'newYearsDay3' => array('day'=>3,
+ 'month'=>1,
+ 'year'=>2013),
+ 'newYearsDay4' => array('day'=>4,
+ 'month'=>1,
+ 'year'=>2013),
+ 'christmasDay' => array('day'=>7,
+ 'month'=>1,
+ 'year'=>2013),
+ 'newYearsDay5' => array('day'=>8,
+ 'month'=>1,
+ 'year'=>2013),
+ 'defenderFatherlandDay' => array('day'=>25,
+ 'month'=>2,
+ 'year'=>2013),
+ 'womensDay' => array('day'=>8,
+ 'month'=>3,
+ 'year'=>2013),
+
+ 'springLabourDay' => array('day'=>1,
+ 'month'=>5,
+ 'year'=>2013),
+ 'victoryDay1' => array('day'=>9,
+ 'month'=>5,
+ 'year'=>2013),
+ 'victoryDay2' => array('day'=>10,
+ 'month'=>5,
+ 'year'=>2013),
+ 'russiaDay' => array('day'=>12,
+ 'month'=>6,
+ 'year'=>2013),
+ 'unityDay' => array('day'=>4,
+ 'month'=>11,
+ 'year'=>2013),
+ );
+
+ /**
+ * setup
+ *
+ * @access public
+ * @return void
+ */
+ function setUp()
+ {
+ }
+
+ /**
+ * test Holidays for 2012
+ *
+ * @access public
+ * @return void
+ */
+ function testHolidays2012()
+ {
+ $drv = Date_Holidays::factory('Russia', 2012, 'en_EN');
+ $this->assertFalse(Date_Holidays::isError($drv));
+ if (Date_Holidays::isError($drv)) {
+ $this->fail($drv->getMessage());
+ }
+
+ foreach ($this->testDates2012 as $name => $dateInfo) {
+ $day = $drv->getHoliday($name);
+ $this->assertFalse(Date_Holidays::isError($day));
+ if (Date_Holidays::isError($day)) {
+ die($day->getMessage());
+ }
+ $this->assertEquals($name, $day->getInternalName());
+ $date = $day->getDate();
+ $this->assertEquals($dateInfo['day'], $date->getDay(), $name);
+ $this->assertEquals($dateInfo['month'], $date->getMonth(), $name);
+ $this->assertEquals($dateInfo['year'], $date->getYear(), $name);
+ }
+ }
+
+ /**
+ * test Holidays for 2013
+ *
+ * @access public
+ * @return void
+ */
+ function testHolidays2013()
+ {
+ $drv = Date_Holidays::factory('Russia', 2013, 'en_EN');
+ $this->assertFalse(Date_Holidays::isError($drv));
+ if (Date_Holidays::isError($drv)) {
+ print_r($drv);
+ die($drv->getMessage());
+ }
+
+ foreach ($this->testDates2013 as $name => $dateInfo) {
+ $day = $drv->getHoliday($name);
+ $this->assertFalse(Date_Holidays::isError($day));
+ if (Date_Holidays::isError($day)) {
+ die($day->getMessage());
+ }
+ $this->assertEquals($name, $day->getInternalName());
+ $date = $day->getDate();
+ $this->assertEquals($dateInfo['day'], $date->getDay(), $name);
+ $this->assertEquals($dateInfo['month'], $date->getMonth(), $name);
+ $this->assertEquals($dateInfo['year'], $date->getYear(), $name);
+ }
+ }
+
+}
+?>
View
31 tests/Date_Holidays_Driver_Serbia_TestSuite.php
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>Testing class Date_Holidays_Driver_Serbia</title>
+</head>
+<body>
+<?php
+ini_set('include_path', '/Applications/MAMP/bin/php/php5.2.17/lib/php');
+require_once 'Date/Holidays.php';
+require_once 'Date/Holidays/Driver/Serbia.php';
+
+$serbia = Date_Holidays::factory('Serbia', 2011, 'sr_RS');
+if (Date_Holidays::isError($serbia)) {
+ die('Factory was unable to produce driver-object');
+}
+
+$internal_names = $serbia->getInternalHolidayNames();
+foreach ($internal_names as $internal_name) {
+ $holiday = $serbia->getHoliday($internal_name, 'sr_RS');
+ if (!Date_Holidays::isError($holiday)) {
+ //print_r(get_class_methods($holiday));
+ echo $holiday->getInternalName() . ' ' .
+ '<b>"' . $holiday->getTitle() . '"</b> ' .
+ $holiday->getDate()->getDate();
+ echo '<br>' . PHP_EOL;
+ }
+}
+?>
+</body>
+</html>
Please sign in to comment.
Something went wrong with that request. Please try again.