Source for file Ireland.php
Documentation is available at Ireland.php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2002 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.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/2_02.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. |
// +----------------------------------------------------------------------+
// | Authors: Ken Guest <ken@linux.ie> |
// +----------------------------------------------------------------------+
// $Id: Ireland.php,v 1.2 2007/05/30 20:52:40 luckec Exp $
require_once 'Date/Holidays/Driver/Christian.php';
* Driver class that calculates Irish holidays
* deriving most calculations from 'Public holidays in Ireland' document
* on http://www.citizensinformation.ie/
* @version $Id: Ireland.php,v 1.2 2007/05/30 20:52:40 luckec Exp $
* @author Ken Guest <ken.guest@ipartners.ie>
* Use the Date_Holidays::factory() method to construct an object of a certain driver
* Build the internal arrays that contain data about the calculated holidays
* @return boolean true on success, otherwise a PEAR_ErrorStack object
* @throws object PEAR_ErrorStack
$this->_addHoliday('stPatricksDay', $this->_year . '-03-17', 'Saint Patrick\'s Day');
$this->_addHoliday('easter', $easterDate, 'Easter Sunday');
* Good Friday / Black Friday
$goodFridayDate = new Date ($easterDate);
$goodFridayDate->subtractSpan (new Date_Span ('2, 0, 0, 0'));
$this->_addHoliday('goodFriday', $goodFridayDate, 'Good Friday');
$this->_addHoliday('easterMonday', $easterDate->getNextDay (), 'Easter Monday');
$dn = $this->_calcFirstMonday ('05');
$this->_addHoliday('mayDayBankHoliday', $dn, 'May Bank Holiday');
* Pentecost (determines Whit Monday, Ascension Day and Feast of Corpus Christi)
$pentecostDate = new Date ($easterDate);
$pentecostDate->addSpan (new Date_Span ('49, 0, 0, 0'));
$this->_addHoliday('pentecost', $pentecostDate, 'Pentecost');
$ascensionDayDate = new Date ($pentecostDate);
$ascensionDayDate->subtractSpan (new Date_Span ('10, 0, 0, 0'));
$this->_addHoliday('ascensionDay', $ascensionDayDate, 'Ascension Day');
$dn = $this->_calcFirstMonday ('06');
$this->_addHoliday('juneBankHoliday', $dn, 'June Bank Holiday');
* Saturday past 20th, June
$juneDate = new Date ($this->_year . '-06-20');
$dayOfWeek = $juneDate->getDayOfWeek ();
$juneDate->addSpan (new Date_Span (sprintf('%d, 0, 0, 0', 6 - $dayOfWeek)));
$midSummerDate = $juneDate;
$this->_addHoliday('midSummer', $midSummerDate, 'Midsummer Day');
$dn = $this->_calcFirstMonday ('08');
$this->_addHoliday('augustBankHoliday', $dn, 'August Bank Holiday');
$dn = $this->_calcLastMonday ('10');
$this->_addHoliday('octoberBankHoliday', $dn, 'October Bank Holiday');
* Calculates the date for Easter. Actually this methods delegates the calculation to
* the {@link Date_Holidays_Driver_Christian#calcEaster()} method.
function calcEaster ($year)
* Method that returns an array containing the ISO3166 codes that may possibly
* @return array possible ISO3166 codes
return array ('ie', 'irl');
* @return object Date date of first monday in specified month.
function _calcFirstMonday ($month)
$date = new Date ($this->_year . " -$month-01" );
while ($date->getDayOfWeek () != 1 ) {
$date = $date->getNextDay ();
* @return object Date date of last monday in specified month.
function _calcLastMonday ($month)
//work backwards from the first day of the next month.
$nm = ((int) $month ) + 1;
$date = new Date ($this->_year . " -$nm-01" );
$date = $date->getPrevDay ();
while ($date->getDayOfWeek () != 1 ) {
$date = $date->getPrevDay ();
Documentation generated on Mon, 11 Mar 2019 15:03:07 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|