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

Source for file Netherlands.php

Documentation is available at Netherlands.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. /**
  4.  * Driver for determining holidays in the Netherlands.
  5.  *
  6.  * PHP Version 5
  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   Jos van der Woude <jos@veerkade.com>
  21.  * @author   Arjen de Korte <build+date_holidays@de-korte.org>
  22.  * @license  http://www.php.net/license/3_01.txt PHP License 3.0.1
  23.  * @version  CVS: $Id: Netherlands.php,v 1.9 2009/03/15 20:17:00 kguest Exp $
  24.  * @link     http://pear.php.net/package/Date_Holidays
  25.  */
  26.  
  27. require_once 'Date/Holidays/Driver/Christian.php';
  28.  
  29. /**
  30.  * Driver class that calculates Dutch holidays
  31.  *
  32.  * @category   Date
  33.  * @package    Date_Holidays
  34.  * @subpackage Driver
  35.  * @author     Jos van der Woude <jos@veerkade.com>
  36.  * @author     Arjen de Korte <build+date_holidays@de-korte.org>
  37.  * @license    http://www.php.net/license/3_01.txt PHP License 3.0.1
  38.  * @version    $Id: Netherlands.php,v 1.9 2009/03/15 20:17:00 kguest Exp $
  39.  * @link       http://pear.php.net/package/Date_Holidays
  40.  */
  41.  
  42. class Date_Holidays_Driver_Netherlands extends Date_Holidays_Driver
  43. {
  44.     /**
  45.      * this driver's name
  46.      *
  47.      * @access   protected
  48.      * @var      string 
  49.      */
  50.     var $_driverName = 'Netherlands';
  51.  
  52.     /**
  53.      * Constructor
  54.      *
  55.      * Use the Date_Holidays::factory() method to construct an object of a
  56.      * certain driver
  57.      *
  58.      * @access protected
  59.      */
  60.     {
  61.     }
  62.  
  63.     /**
  64.      * Build the internal arrays that contain data about the calculated holidays
  65.      *
  66.      * @access protected
  67.      * @return boolean true on success, otherwise a PEAR_ErrorStack object
  68.      * @throws object PEAR_ErrorStack
  69.      */
  70.     function _buildHolidays()
  71.     {
  72.         /**
  73.          * Start with all holidays that are on a fixed date each year
  74.          */
  75.  
  76.         /**
  77.          * New Year's Day
  78.          */
  79.         $this->_addHoliday(
  80.             'newYearsDay',
  81.             $this->_year '-01-01',
  82.             'New Year\'s Day'
  83.         );
  84.  
  85.         /**
  86.          * Epiphanias
  87.          */
  88.         $this->_addHoliday('epiphany'$this->_year '-01-06''Epiphany');
  89.  
  90.         /**
  91.          * Valentine's Day
  92.          */
  93.         $this->_addHoliday(
  94.             'valentineDay',
  95.             $this->_year '-02-14',
  96.             'Valentine\'s Day'
  97.         );
  98.  
  99.         /**
  100.          * Queen's Day
  101.          */
  102.         $this->_addHoliday('queenDay'$this->_year '-04-30''Queen\'s Day');
  103.  
  104.         /**
  105.          * Labour Day
  106.          */
  107.         $this->_addHoliday('labourDay'$this->_year '-05-01''Labour Day');
  108.  
  109.         /**
  110.          * Commemoration Day
  111.          */
  112.         $this->_addHoliday(
  113.             'commemorationDay',
  114.             $this->_year '-05-04',
  115.             'Commemoration Day'
  116.         );
  117.  
  118.         /**
  119.          * Liberation Day
  120.          */
  121.         $this->_addHoliday(
  122.             'liberationDay',
  123.             $this->_year '-05-05',
  124.             'Liberation Day'
  125.         );
  126.  
  127.         /**
  128.          * World Animal Day
  129.          */
  130.         $this->_addHoliday(
  131.             'worldAnimalDay',
  132.             $this->_year '-10-04',
  133.             'World Animal Day'
  134.         );
  135.  
  136.         /**
  137.          * Halloween
  138.          */
  139.         $this->_addHoliday('halloween'$this->_year '-10-31''Halloween');
  140.  
  141.         /**
  142.          * St. Martins Day
  143.          */
  144.         $this->_addHoliday(
  145.             'stMartinsDay',
  146.             $this->_year '-11-11',
  147.             'St. Martin\'s Day'
  148.         );
  149.  
  150.         /**
  151.          * St. Nicholas' Day
  152.          */
  153.         $this->_addHoliday(
  154.             'stNicholasDay',
  155.             $this->_year '-12-05',
  156.             'St. Nicholas\' Day'
  157.         );
  158.  
  159.         /**
  160.          * Christmas day
  161.          */
  162.         $this->_addHoliday(
  163.             'christmasDay',
  164.             $this->_year '-12-25',
  165.             'Christmas Day'
  166.         );
  167.  
  168.         /**
  169.          * Second Christmas Day
  170.          */
  171.         $this->_addHoliday(
  172.             'secondChristmasDay',
  173.             $this->_year '-12-26',
  174.             'Boxing Day'
  175.         );
  176.  
  177.         /**
  178.          * New Year's Eve
  179.          */
  180.         $this->_addHoliday(
  181.             'newYearsEve',
  182.             $this->_year '-12-31',
  183.             'New Year\'s Eve'
  184.         );
  185.  
  186.  
  187.         /**
  188.          * Following section is holidays that are a fixed offset from Easter (which
  189.          * differs each year)
  190.          */
  191.         $easterDate = Date_Holidays_Driver_Christian::calcEaster($this->_year);
  192.  
  193.         /**
  194.          * Carnival
  195.          */
  196.         $this->_addHoliday(
  197.             'carnival1',
  198.             $this->_addDays($easterDate-49),
  199.             'Carnival'
  200.         );
  201.         $this->_addHoliday(
  202.             'carnival2',
  203.             $this->_addDays($easterDate-48),
  204.             'Carnival'
  205.         );
  206.         $this->_addHoliday(
  207.             'carnival3',
  208.             $this->_addDays($easterDate-47),
  209.             'Carnival'
  210.         );
  211.  
  212.         /**
  213.          * Ash Wednesday
  214.          */
  215.         $this->_addHoliday(
  216.             'ashWednesday',
  217.             $this->_addDays($easterDate-46),
  218.             'Ash Wednesday'
  219.         );
  220.  
  221.         /**
  222.          * Green Thursday
  223.          */
  224.         $this->_addHoliday(
  225.             'greenThursday',
  226.             $this->_addDays($easterDate-3),
  227.             'Green Thursday'
  228.         );
  229.  
  230.         /**
  231.          * Good Friday / Black Friday
  232.          */
  233.         $this->_addHoliday(
  234.             'goodFriday',
  235.             $this->_addDays($easterDate-2),
  236.             'Good Friday'
  237.         );
  238.  
  239.         /**
  240.          * Silent Saturday
  241.          */
  242.         $this->_addHoliday(
  243.             'silentSaturday',
  244.             $this->_addDays($easterDate-1),
  245.             'Silent Saturday'
  246.         );
  247.  
  248.         /**
  249.          * Easter Sunday
  250.          */
  251.         $this->_addHoliday('easter'$easterDate'Easter Sunday');
  252.  
  253.         /**
  254.          * Easter Monday
  255.          */
  256.         $this->_addHoliday(
  257.             'easterMonday',
  258.             $this->_addDays($easterDate1),
  259.             'Easter Monday'
  260.         );
  261.  
  262.         /**
  263.          * Ascension Day
  264.          */
  265.         $this->_addHoliday(
  266.             'ascensionDay',
  267.             $this->_addDays($easterDate39),
  268.             'Ascension Day'
  269.         );
  270.  
  271.         /**
  272.          * Whitsun
  273.          */
  274.         $this->_addHoliday('whitsun'$this->_addDays($easterDate49)'Whitsun');
  275.  
  276.         /**
  277.          * Whit Monday
  278.          */
  279.         $this->_addHoliday(
  280.             'whitMonday',
  281.             $this->_addDays($easterDate50),
  282.             'Whit Monday'
  283.         );
  284.  
  285.  
  286.         /**
  287.          * Lastly a number of holidays that are the second/third/last Sunday
  288.          * or Tuesday in a specific month (offset is calculated from the first
  289.          * of last possible date)
  290.          */
  291.  
  292.         /**
  293.          * Summertime last sunday of march
  294.          */
  295.         $summerTime = new Date($this->_year '-03-31');
  296.         $dayOfWeek  $summerTime->getDayOfWeek();
  297.         $summerTime $this->_addDays($summerTime-$dayOfWeek);
  298.         $this->_addHoliday('summerTime'$summerTime'Summertime');
  299.  
  300.         /**
  301.          * Mothers' Day second sunday of may
  302.          */
  303.         $mothersDay = new Date($this->_year '-05-08');
  304.         $dayOfWeek  $mothersDay->getDayOfWeek();
  305.         if ($dayOfWeek != 0{
  306.             $mothersDay $this->_addDays($mothersDay7 - $dayOfWeek);
  307.         }
  308.         $this->_addHoliday('mothersDay'$mothersDay'Mothers\' Day');
  309.  
  310.         /**
  311.          * Fathers' Day third sunday of june
  312.          */
  313.         $fathersDay = new Date($this->_year '-06-15');
  314.         $dayOfWeek  $fathersDay->getDayOfWeek();
  315.         if ($dayOfWeek != 0{
  316.             $fathersDay $this->_addDays($fathersDay7 - $dayOfWeek);
  317.         }
  318.         $this->_addHoliday('fathersDay'$fathersDay'Fathers\' Day');
  319.  
  320.         /**
  321.          * Start of Parliamentary Year third tuesday of september
  322.          */
  323.         $princesDay = new Date($this->_year '-09-15');
  324.         $dayOfWeek  $princesDay->getDayOfWeek();
  325.         if ($dayOfWeek <= 2{
  326.             $princesDay $this->_addDays($princesDay2 - $dayOfWeek);
  327.         else {
  328.             $princesDay $this->_addDays($princesDay9 - $dayOfWeek);
  329.         }
  330.         $this->_addHoliday('princesDay'$princesDay'Start of Parliamentary Year');
  331.  
  332.         /**
  333.          * Wintertime last sunday of october
  334.          */
  335.         $winterTime = new Date($this->_year '-10-31');
  336.         $dayOfWeek  $winterTime->getDayOfWeek();
  337.         $winterTime $this->_addDays($winterTime-$dayOfWeek);
  338.         $this->_addHoliday('winterTime'$winterTime'Wintertime');
  339.  
  340.         if (Date_Holidays::errorsOccurred()) {
  341.             return Date_Holidays::getErrorStack();
  342.         }
  343.  
  344.         return true;
  345.     }
  346.  
  347.     /**
  348.      * Method that returns an array containing the ISO3166 codes that may possibly
  349.      * identify a driver.
  350.      *
  351.      * @static
  352.      * @access public
  353.      * @return array possible ISO3166 codes
  354.      */
  355.     function getISO3166Codes()
  356.     {
  357.         return array('nl''nld');
  358.     }
  359. }
  360. ?>

Documentation generated on Wed, 12 Dec 2012 00:30:06 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.