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

Source for file Norway.php

Documentation is available at Norway.php

  1. <?php
  2.  
  3. require_once 'Christian.php';
  4.  
  5. /**
  6.  * Driver class that calculates Norwegian holidays
  7.  *
  8.  * Sensorlink AS (c) 2006
  9.  * Vegard Fiksdal <fiksdal@sensorlink.no>
  10.  */
  11.  
  12. {
  13.    /**
  14.     * Constructor
  15.     *
  16.     * Use the Date_Holidays::factory() method to construct an object of a certain driver
  17.     *
  18.     * @access   protected
  19.     */
  20.     function Date_Holidays_Driver_Norway (
  21.     {
  22.     }
  23.  
  24.    /**
  25.     * Build the internal arrays that contain data about the calculated holidays
  26.     *
  27.     * @access   protected
  28.     * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  29.     * @throws   object PEAR_ErrorStack
  30.     */
  31.     function _buildHolidays()
  32.     {
  33.        /**
  34.         * New Year's Day
  35.         */
  36.         $this->_addHoliday('newYearsDay'$this->_year . '-01-01''New Year\'s Day');
  37.  
  38.        /**
  39.         * Easter Sunday
  40.         */
  41.         $easterDate Date_Holidays_Driver_Norway::calcEaster($this->_year);
  42.         $this->_addHoliday('easter'$easterDate'Easter Sunday');
  43.  
  44.        /**
  45.         * Good Friday / Black Friday
  46.         */
  47.         $goodFridayDate = new Date($easterDate);
  48.         $goodFridayDate->subtractSpan(new Date_Span('2, 0, 0, 0'));
  49.         $this->_addHoliday('goodFriday'$goodFridayDate'Good Friday');
  50.  
  51.        /**
  52.         * Easter Monday
  53.         */
  54.         $this->_addHoliday('easterMonday'$easterDate->getNextDay()'Easter Monday');
  55.  
  56.        /**
  57.         * May Day
  58.         */
  59.         $this->_addHoliday('mayDay'$this->_year . '-05-01''May Day');
  60.  
  61.        /**
  62.         * Pentecost (determines Whit Monday, Ascension Day and Feast of Corpus Christi)
  63.         */
  64.         $pentecostDate = new Date($easterDate);
  65.         $pentecostDate->addSpan(new Date_Span('49, 0, 0, 0'));
  66.         $this->_addHoliday('pentecost'$pentecostDate'Pentecost');
  67.  
  68.        /**
  69.         * Ascension Day
  70.         */
  71.         $ascensionDayDate = new Date($pentecostDate);
  72.         $ascensionDayDate->subtractSpan(new Date_Span('10, 0, 0, 0'));
  73.         $this->_addHoliday('ascensionDay'$ascensionDayDate'Ascension Day');
  74.  
  75.        /**
  76.         * Norwegian National Day
  77.         */
  78.         $this->_addHoliday('norwayNationalDay'$this->_year . '-05-17'
  79.                 'Norwegian National Day');
  80.  
  81.        /**
  82.         * Christmas Eve
  83.         */
  84.         $this->_addHoliday('xmasEve'$this->_year . '-12-24''Christmas Eve');
  85.  
  86.        /**
  87.         * Christmas day
  88.         */
  89.         $this->_addHoliday('xmasDay'$this->_year . '-12-25''Christmas Day');
  90.  
  91.        /**
  92.         * Boxing day
  93.         */
  94.         $this->_addHoliday('boxingDay'$this->_year . '-12-26''Boxing Day');
  95.  
  96.        /**
  97.         * New Year's Eve
  98.         */
  99.         $this->_addHoliday('newYearsEve'$this->_year . '-12-31''New Year\'s Eve');
  100.  
  101.         if (Date_Holidays::errorsOccurred()) {
  102.             return Date_Holidays::getErrorStack();
  103.         }
  104.  
  105.         return true;
  106.     }
  107.  
  108.    /**
  109.     * Calculates the date for Easter. Actually this methods delegates the calculation to
  110.     * the {@link Date_Holidays_Driver_Christian#calcEaster()} method.
  111.     *
  112.     * @static
  113.     * @access   private
  114.     * @param    int     $year   year
  115.     * @return   object Date 
  116.     */
  117.     function calcEaster($year)
  118.     {
  119.         return Date_Holidays_Driver_Christian::calcEaster($year);
  120.     }
  121.     
  122.    /**
  123.     * Method that returns an array containing the ISO3166 codes that may possibly
  124.     * identify a driver.
  125.     * 
  126.     * @static
  127.     * @access public
  128.     * @return array possible ISO3166 codes
  129.     */
  130.     function getISO3166Codes({
  131.         return array('no''nor');
  132.     }
  133. }
  134. ?>

Documentation generated on Mon, 11 Mar 2019 15:14:34 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.