Date_Holidays
[ class tree: Date_Holidays ] [ index: Date_Holidays ] [ all elements ]

Source for file EnglandWales.php

Documentation is available at EnglandWales.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. /**
  4.  * Driver for holidays in Germany
  5.  *
  6.  * PHP Version 4
  7.  *
  8.  * Copyright (c) 1997-2008 The PHP Group
  9.  *
  10.  * This source file is subject to version 3.0 of the PHP license,
  11.  * that is bundled with this package in the file LICENSE, and is
  12.  * available at through the world-wide-web at
  13.  * http://www.php.net/license/3_01.txt.
  14.  * If you did not receive a copy of the PHP license and are unable to
  15.  * obtain it through the world-wide-web, please send a note to
  16.  * license@php.net so we can mail you a copy immediately.
  17.  *
  18.  * @category Date
  19.  * @package  Date_Holidays
  20.  * @author   Tim Dodge <timmy@invisibles.org>
  21.  * @license  http://www.php.net/license/3_01.txt PHP License 3.0.1
  22.  * @version  CVS: $Id: EnglandWales.php,v 1.8 2008/03/17 11:37:49 kguest Exp $
  23.  * @link     http://pear.php.net/package/Date_Holidays
  24.  */
  25. require_once 'Date/Holidays/Driver/Christian.php';
  26. require_once 'Date/Holidays/Driver/USA.php';
  27.  
  28. /**
  29.  * Driver class that calculates Danish holidays
  30.  *
  31.  * @category   Date
  32.  * @package    Date_Holidays
  33.  * @subpackage Driver
  34.  * @author     Tim Dodge <timmy@invisibles.org>
  35.  * @license    http://www.php.net/license/3_01.txt PHP License 3.0.1
  36.  * @version    CVS: $Id: EnglandWales.php,v 1.8 2008/03/17 11:37:49 kguest Exp $
  37.  * @link       http://pear.php.net/package/Date_Holidays
  38.  */
  39. {
  40.     /**
  41.      * Constructor
  42.      *
  43.      * Use the Date_Holidays::factory() method to construct an object of a
  44.      * certain driver
  45.      *
  46.      * @access protected
  47.      */
  48.     {
  49.     }
  50.  
  51.     /**
  52.      * Build the internal arrays that contain data about the calculated holidays
  53.      *
  54.      * @access protected
  55.      * @return boolean true on success, otherwise a PEAR_ErrorStack object
  56.      * @throws object PEAR_ErrorStack
  57.      */
  58.     function _buildHolidays()
  59.     {
  60.         /**
  61.          * New Year's Day
  62.          */
  63.         $newYearsDay = new Date($this->_year . '-01-01');
  64.         if ($newYearsDay->getDayOfWeek(== 0{
  65.             $this->_addHoliday('newYearsDay',
  66.                                $this->_year . '-01-02',
  67.                                'Substitute Bank Holiday in lieu of New Year\'s Day');
  68.         elseif ($newYearsDay->getDayOfWeek(== 6{
  69.             $this->_addHoliday('newYearsDay',
  70.                                $this->_year . '-01-03',
  71.                                'Substitute Bank Holiday in lieu of New Year\'s Day');
  72.         else {
  73.             $this->_addHoliday('newYearsDay',
  74.                                $newYearsDay,
  75.                                'New Year\'s Day');
  76.         }
  77.  
  78.         /**
  79.          * Easter Sunday
  80.          */
  81.         $easterDate Date_Holidays_Driver_Christian::calcEaster($this->_year);
  82.  
  83.         /**
  84.          * Good Friday
  85.          */
  86.         $goodFridayDate = new Date($easterDate);
  87.         $goodFridayDate->subtractSpan(new Date_Span('2, 0, 0, 0'));
  88.         $this->_addHoliday('goodFriday'$goodFridayDate'Good Friday');
  89.  
  90.         /**
  91.          * Easter Monday
  92.          */
  93.         $this->_addHoliday('easterMonday',
  94.                            $easterDate->getNextDay(),
  95.                            'Easter Monday');
  96.  
  97.         /**
  98.          * May Day Bank Holiday
  99.          */
  100.         $earlyMayDate Date_Holidays_Driver_USA::_calcNthMondayInMonth(51);
  101.         $this->_addHoliday('mayDay'$earlyMayDate'May Day Bank Holiday');
  102.  
  103.         /**
  104.          * Spring Bank Holiday
  105.          */
  106.         $springBankDate Date_Holidays_Driver_USA::_calcLastMondayInMonth(5);
  107.         $this->_addHoliday('springBank'$springBankDate'Spring Bank Holiday');
  108.  
  109.         /**
  110.          * Summer Bank Holiday
  111.          */
  112.         $summerBankDate Date_Holidays_Driver_USA::_calcLastMondayInMonth(8);
  113.         $this->_addHoliday('summerBank'$summerBankDate'Summer Bank Holiday');
  114.  
  115.         /**
  116.          * Christmas and Boxing Day
  117.          */
  118.         $christmasDay = new Date($this->_year . '-12-25');
  119.         if ($christmasDay->getDayOfWeek(== 0{
  120.             $this->_addHoliday('boxingDay'$this->_year . '-12-26''Boxing Day');
  121.             $this->_addHoliday('christmasDay',
  122.                                $this->_year . '-12-27',
  123.                                'Substitute Bank Holiday in lieu of Christmas Day');
  124.         elseif ($christmasDay->getDayOfWeek(== 5{
  125.             $this->_addHoliday('christmasDay'$christmasDay'Christmas Day');
  126.             $this->_addHoliday('boxingDay',
  127.                                $this->_year . '-12-28',
  128.                                'Substitute Bank Holiday in lieu of Boxing Day');
  129.         elseif ($christmasDay->getDayOfWeek(== 6{
  130.             $this->_addHoliday('christmasDay',
  131.                                $this->_year . '-12-28',
  132.                                'Substitute Bank Holiday in lieu of Christmas Day');
  133.             $this->_addHoliday('boxingDay',
  134.                                $this->_year . '-12-27',
  135.                                'Substitute Bank Holiday in lieu of Boxing Day');
  136.         else {
  137.             $this->_addHoliday('christmasDay'$christmasDay'Christmas Day');
  138.             $this->_addHoliday('boxingDay'$this->_year . '-12-26''Boxing Day');
  139.         }
  140.  
  141.         if (Date_Holidays::errorsOccurred()) {
  142.             return Date_Holidays::getErrorStack();
  143.         }
  144.  
  145.         return true;
  146.     }
  147.  
  148.     /**
  149.      * Method that returns an array containing the ISO3166 codes that may possibly
  150.      * identify a driver.
  151.      *
  152.      * @static
  153.      * @access public
  154.      * @return array possible ISO3166 codes
  155.      */
  156.     function getISO3166Codes()
  157.     {
  158.         return array('gb''gbr');
  159.     }
  160. }
  161. ?>

Documentation generated on Thu, 10 Apr 2008 20:00:16 -0400 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.