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

Source for file Driver.php

Documentation is available at Driver.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2002 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.0 of the PHP license,       |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors:   Carsten Lucke <luckec@tool-garage.de>                     |
  17. // +----------------------------------------------------------------------+
  18. //
  19. //    $Id: Driver.php,v 1.22 2004/08/09 18:03:49 luckec Exp $s
  20.  
  21. /**
  22.  * uses PEAR_Errorstack
  23.  */
  24. require_once 'PEAR/ErrorStack.php';
  25.  
  26. /**
  27.  * invalid internal name
  28.  *
  29.  * @access  public
  30.  */
  31. define('DATE_HOLIDAYS_INVALID_INTERNAL_NAME'51);
  32.  
  33. /**
  34.  * title for a holiday is not available
  35.  *
  36.  * @access  public
  37.  */
  38. define('DATE_HOLIDAYS_TITLE_UNAVAILABLE'52);
  39.  
  40. /**
  41.  * date could not be converted into a PEAR::Date object
  42.  *
  43.  * date was neither a timestamp nor a string
  44.  *
  45.  * @access  public
  46.  * @deprecated   will certainly be removed
  47.  */
  48. define('DATE_HOLIDAYS_INVALID_DATE'53);
  49.  
  50. /**
  51.  * string that represents a date has wrong format
  52.  *
  53.  * format must be YYYY-MM-DD
  54.  *
  55.  * @access  public
  56.  * @deprecated   will certainly be removed
  57.  */
  58. define('DATE_HOLIDAYS_INVALID_DATE_FORMAT'54);
  59.  
  60. /**
  61.  * date for a holiday is not available
  62.  *
  63.  * @access  public
  64.  */
  65. define('DATE_HOLIDAYS_DATE_UNAVAILABLE'55);
  66.  
  67. /**
  68.  * language-file doesn't exist
  69.  *
  70.  * @access  public
  71.  */
  72. define('DATE_HOLIDAYS_LANGUAGEFILE_NOT_FOUND'56);
  73.  
  74. /**
  75.  * class that helps you to locate holidays for a year
  76.  *
  77.  * @abstract
  78.  * @category    Date
  79.  * @package     Date_Holidays
  80.  * @version     $Id: Driver.php,v 1.22 2004/08/09 18:03:49 luckec Exp $
  81.  * @author      Carsten Lucke <luckec@tool-garage.de>
  82.  */
  83. {
  84.    /**
  85.     * locale setting for output
  86.     *
  87.     * @access   protected
  88.     * @var      string 
  89.     */
  90.     var $_locale;
  91.     
  92.    /**
  93.     * locales for which translations of holiday titles are available
  94.     *
  95.     * @access   private
  96.     * @var      array 
  97.     */
  98.     var $_availableLocales = array('C');
  99.     
  100.    /**
  101.     * object's current year
  102.     *
  103.     * @access   protected
  104.     * @var      int 
  105.     */
  106.     var $_year;
  107.     
  108.    /**
  109.     * internal names for the available holidays
  110.     *
  111.     * @access   protected
  112.     * @var      array 
  113.     */
  114.     var $_internalNames = array();
  115.     
  116.    /**
  117.     * dates of the available holidays
  118.     *
  119.     * @access   protected
  120.     * @var      array 
  121.     */
  122.     var $_dates = array();
  123.     
  124.    /**
  125.     * localized names of the available holidays
  126.     *
  127.     * @access   protected
  128.     * @var      array 
  129.     */
  130.     var $_titles = array();
  131.     
  132.    /**
  133.     * Constructor
  134.     *
  135.     * Use the Date_Holidays::factory() method to construct an object of a certain driver
  136.     *
  137.     * @access   protected
  138.     */
  139.     function Date_Holidays_Driver()
  140.     {
  141.     }
  142.     
  143.    /**
  144.     * Sets the driver's current year
  145.     *
  146.     * Calling this method forces the object to rebuild the holidays
  147.     *
  148.     * @access   public
  149.     * @param    int     $year   year
  150.     * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  151.     * @throws   object PEAR_ErrorStack
  152.     * @uses     _buildHolidays()
  153.     */
  154.     function setYear($year)
  155.     {
  156.         $this->_year    =   $year;
  157.         return $this->_buildHolidays();
  158.     }
  159.     
  160.    /**
  161.     * Returns the driver's current year
  162.     *
  163.     * @access   public
  164.     * @return   int     current year
  165.     */
  166.     function getYear()
  167.     {
  168.         return $this->_year;
  169.     }
  170.     
  171.    /**
  172.     * Build the internal arrays that contain data about the calculated holidays
  173.     *
  174.     * @abstract
  175.     * @access   protected
  176.     * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  177.     * @throws   object PEAR_ErrorStack
  178.     */
  179.     function _buildHolidays()
  180.     {
  181.     }
  182.     
  183.    /**
  184.     * Add a driver component
  185.     *
  186.     *
  187.     *
  188.     * @abstract
  189.     * @access   public
  190.     * @param    object Date_Holidays_Driver $driver driver-object
  191.     */
  192.     function addDriver($driver)
  193.     {
  194.     }
  195.     
  196.    /**
  197.     * Remove a driver component
  198.     *
  199.     * @abstract
  200.     * @access   public
  201.     * @param    object Date_Holidays_Driver $driver driver-object
  202.     * @return   boolean true on success, otherwise a PEAR_Error object
  203.     * @throws   object PEAR_Error   DATE_HOLIDAYS_DRIVER_NOT_FOUND
  204.     */
  205.     function removeDriver($driver)
  206.     {
  207.     }
  208.     
  209.    /**
  210.     * Returns the internal names of holidays that were calculated
  211.     *
  212.     * @access   public
  213.     * @return   array 
  214.     */
  215.     function getInternalHolidayNames()
  216.     {
  217.         return $this->_internalNames;
  218.     }
  219.     
  220.    /**
  221.     * Returns localized titles of all holidays or those specififed in $restrict array
  222.     *
  223.     * @access   public
  224.     * @param    array   $restrict   internal names of desired holidays
  225.     * @param    string  $locale     locale setting that shall be used by this method
  226.     * @return   array with localized holiday titles on success, otherwise a PEAR_Error object
  227.     * @throws   object PEAR_Error   DATE_HOLIDAYS_INVALID_INTERNAL_NAME
  228.     * @uses     getHolidayTitle()
  229.     */
  230.     function getHolidayTitles($restrict = array()$locale = null)
  231.     {
  232.         if (empty($restrict)) {
  233.             $restrict   $this->_internalNames;
  234.         }
  235.         
  236.         $titles =   array();
  237.         foreach ($restrict as $internalName{
  238.             $title  $this->getHolidayTitle($internalName$locale);
  239.             if (Date_Holidays::isError($title)) {
  240.                 return $title;
  241.             }
  242.             $titles[$internalName]  $title;
  243.         }
  244.         return $titles;
  245.     }
  246.     
  247.    /**
  248.     * Returns localized title for a holiday
  249.     *
  250.     * @access   public
  251.     * @param    string  $internalName   internal name for holiday
  252.     * @param    string  $locale         locale setting that shall be used by this method
  253.     * @return   string  title on success, otherwise a PEAR_Error object
  254.     * @throws   object PEAR_Error   DATE_HOLIDAYS_INVALID_INTERNAL_NAME, DATE_HOLIDAYS_TITLE_UNAVAILABLE
  255.     */
  256.     function getHolidayTitle($internalName$locale = null)
  257.     {
  258.         if (in_array($internalName$this->_internalNames)) {
  259.             return Date_Holidays::raiseError(DATE_HOLIDAYS_INVALID_INTERNAL_NAME'Invalid internal name: ' $internalName);
  260.         }
  261.         
  262.         if (is_null($locale)) {
  263.             $locale =   $this->_findBestLocale($this->_locale);
  264.         else {
  265.             $locale =   $this->_findBestLocale($locale);
  266.         }
  267.         
  268.         if (isset($this->_titles[$locale][$internalName])) {
  269.             if (Date_Holidays::staticGetProperty('DIE_ON_MISSING_LOCALE')) {
  270.                 return Date_Holidays::raiseError(DATE_HOLIDAYS_TITLE_UNAVAILABLE'The internal name (' $internalName 
  271.                     ') for the holiday was correct but no localized title could be found');
  272.             }
  273.         }
  274.  
  275.         return isset($this->_titles[$locale][$internalName]
  276.             $this->_titles[$locale][$internalName$this->_titles['C'][$internalName];
  277.     }
  278.     
  279.    /**
  280.     * Returns all holidays that the driver knows.
  281.     *
  282.     * You can limit the holidays by setting the $restrict array, then only those
  283.     * will be returned, whose internal name occurrs in this array.
  284.     *
  285.     * Return format:
  286.     * <pre>
  287.     *   array(
  288.     *       'easter'        =>  object of type Date_Holidays_Holiday,
  289.     *       'eastermonday'  =>  object of type Date_Holidays_Holiday,
  290.     *       ...
  291.     *   )
  292.     * </pre>
  293.     *
  294.     * @access   public
  295.     * @param    array   $restrict   internal names of desired holidays
  296.     * @return   array   numeric array containing objects of Date_Holidays_Holiday on success, otherwise a PEAR_Error object
  297.     * @throws   object PEAR_Error   DATE_HOLIDAYS_INVALID_INTERNAL_NAME
  298.     * @see      getHoliday()
  299.     * @uses     getHoliday()
  300.     */
  301.     function getHolidays($restrict = array())
  302.     {
  303.         if (empty($restrict)) {
  304.             $restrict   $this->_internalNames;
  305.         }
  306.         
  307.         $holidays       = array();
  308.         foreach ($restrict as $internalName{
  309.             if (in_array($internalName$this->_internalNames)) {
  310.                 return Date_Holidays::raiseError(DATE_HOLIDAYS_INVALID_INTERNAL_NAME'Invalid internal name: ' $internalName);
  311.             }
  312.             $holidays[$internalName]    &$this->getHoliday($internalName);
  313.         }
  314.         return $holidays;
  315.     }
  316.     
  317.    /**
  318.     * Returns the specified holiday
  319.     *
  320.     * Return format:
  321.     * <pre>
  322.     *   array(
  323.     *       'title' =>  'Easter Sunday'
  324.     *       'date'  =>  '2004-04-11'
  325.     *   )
  326.     * </pre>
  327.     *
  328.     * @access   public
  329.     * @param    string  $internalName   internal name of the holiday
  330.     * @param    string  $locale         locale setting that shall be used by this method
  331.     * @return   object Date_Holidays_Holiday    holiday's information on success, otherwise a PEAR_Error object
  332.     * @throws   object PEAR_Error       DATE_HOLIDAYS_INVALID_INTERNAL_NAME
  333.     * @uses     getHolidayTitle()
  334.     * @uses     getHolidayDate()
  335.     */
  336.     function getHoliday($internalName$locale = null)
  337.     {
  338.         if (in_array($internalName$this->_internalNames)) {
  339.                 'Invalid internal name: ' $internalName);
  340.         }
  341.         if (is_null($locale)) {
  342.             $locale $this->_locale;
  343.         }
  344.         
  345.         $title      $this->getHolidayTitle($internalName$locale);
  346.         if (Date_Holidays::isError($title)) {
  347.             return $title;
  348.         }
  349.         $date       &$this->getHolidayDate($internalName);
  350.         if (Date_Holidays::isError($date)) {
  351.             return $date;
  352.         }
  353.         
  354.         return new Date_Holidays_Holiday($internalName$title$date);
  355.     }
  356.     
  357.    /**
  358.     * Determines whether a date represents a holiday or not
  359.     *
  360.     * @access   public
  361.     * @param    mixed   $date   date (can be a timestamp, string or PEAR::Date object)
  362.     * @return   boolean true if date represents a holiday, otherwise false
  363.     * @throws   object PEAR_Error   DATE_HOLIDAYS_INVALID_DATE, DATE_HOLIDAYS_INVALID_DATE_FORMAT
  364.     */
  365.     function isHoliday($date)
  366.     {
  367.         if (is_a($date'Date')) {
  368.             $date   =$this->_convertDate($date);
  369.             if (Date_Holidays::isError($date)) {
  370.                 return $date;
  371.             }
  372.         }
  373.         
  374.         foreach (array_values($this->_datesas $holidayDate{
  375.             if ($date->compare($date$holidayDate!= 0{
  376.                 continue;
  377.             }
  378.             return true;
  379.         }
  380.         return false;
  381.     }
  382.     
  383.    /**
  384.     * Returns the title of the holiday, if any was found, matching the specified date.
  385.     *
  386.     * Normally the method will return the title/data for the first holiday matching the date.
  387.     * If you want the mthod to continue searching holidays for the specified date, set the 4th param to true
  388.     * If multiple holidays match your date, the return value will be an array of the titles/data.
  389.     * <pre>
  390.     * array(
  391.     *   array(
  392.     *       'title' => 'New Year',
  393.     *       'date'  => Object of type Date
  394.     *   ),
  395.     *   array(
  396.     *       'title' => 'Circumcision of Jesus',
  397.     *       'date'  => Object of type Date
  398.     *   )
  399.     * )
  400.     * </pre>
  401.     *
  402.     * @access   public
  403.     * @param    mixed   $date       date (timestamp | string | PEAR::Date object)
  404.     * @param    string  $locale     locale setting that shall be used by this method
  405.     * @param    boolean $multiple 
  406.     * @return   object  object of type Date_Holidays_Holiday on success
  407.     *                    (numeric array of those on multiple search),
  408.     *                    if no holiday was found, matching this date, null is returned
  409.     * @throws   object PEAR_Error   DATE_HOLIDAYS_INVALID_DATE, DATE_HOLIDAYS_INVALID_DATE_FORMAT
  410.     * @uses     getHoliday()
  411.     * @uses     getHolidayTitle()
  412.     * @see      getHoliday()
  413.     ***/
  414.     function getHolidayForDate($date$locale = null$multiple = false)
  415.     {
  416.          // array that collects data, if multiple searching is done
  417.         $data           = array();
  418.         
  419.         if (is_null($locale)) {
  420.             $locale     $this->_locale;
  421.         }
  422.         if (is_a($date'Date')) {
  423.             $date       &$this->_convertDate($date);
  424.             if (Date_Holidays::isError($date)) {
  425.                 return $date;
  426.             }
  427.         }
  428.         
  429.         foreach ($this->_dates as $internalName => $holidayDate{
  430.             if ($date->compare($date$holidayDate!= 0{
  431.                 continue;
  432.             }
  433.             
  434.             $result &$this->getHoliday($internalName$locale);
  435.             if ($multiple{
  436.                 if (Date_Holidays::isError($result)) {
  437.                     return null;
  438.                 
  439.                 return $result;
  440.             else {
  441.                 if (Date_Holidays::isError($result)) {
  442.                     continue;
  443.                 }
  444.                 $data[&$result;
  445.             }
  446.         }
  447.         if (empty($data)) {
  448.             return $data;
  449.         }
  450.         return null;
  451.     }
  452.     
  453.    /**
  454.     * Converts timestamp or date-string into da PEAR::Date object
  455.     *
  456.     * @static
  457.     * @access   private
  458.     * @param    mixed   $date   date
  459.     * @return   object PEAR_Date 
  460.     * @throws   object PEAR_Error   DATE_HOLIDAYS_INVALID_DATE, DATE_HOLIDAYS_INVALID_DATE_FORMAT
  461.     */
  462.     function _convertDate($date)
  463.     {
  464.         if (is_string($date)) {
  465.             if (preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}/'$date)) {
  466.                 return Date_Holidays::raiseError(DATE_HOLIDAYS_INVALID_DATE_FORMAT
  467.                     'Date-string has wrong format (must be YYYY-MM-DD)');
  468.             }
  469.             return new Date($date);
  470.         }
  471.         
  472.         if (is_int($date)) {
  473.             return new Date($date);
  474.         }
  475.         
  476.             'The date you specified is invalid');
  477.     }
  478.     
  479.    /**
  480.     * Adds all holidays in the array to the driver's internal list of holidays.
  481.     * 
  482.     * Format of the array:
  483.     * <pre>
  484.     *   array(
  485.     *       'newYearsDay'   => array(
  486.     *           'date'          => '01-01',
  487.     *           'title'         => 'New Year\'s Day',
  488.     *           'translations'  => array(
  489.     *               'de_DE' =>  'Neujahr',
  490.     *               'en_EN' =>  'New Year\'s Day'
  491.     *           )
  492.     *       ),
  493.     *       'valentinesDay' => array(
  494.     *           ...
  495.     *       )
  496.     *   );
  497.     * </pre>
  498.     * 
  499.     * @access   protected
  500.     * @param    array       $holidays   static holidays' data
  501.     * @uses     _addHoliday()
  502.     * @uses     _addTranslationForHoliday()
  503.     */
  504.     function _addStaticHolidays($holidays)
  505.     {
  506.         foreach ($holidays as $internalName => $holiday{
  507.             // add the holiday's basic data
  508.             $this->_addHoliday($internalName$this->_year . '-' $holiday['date']$holiday['title']);
  509.         }
  510.     }
  511.     
  512.    /**
  513.     * Adds a holiday to the driver's holidays
  514.     *
  515.     * @access   protected
  516.     * @param    string  $internalName   internal name - must not contain characters that aren\'t allowes as variable-names
  517.     * @param    mixed   $date           date (timestamp | string | PEAR::Date object)
  518.     * @param    string  $title          holiday title
  519.     */
  520.     function _addHoliday($internalName$date$title)
  521.     {
  522.         if (is_a($date'Date')) {
  523.             $date   =&  new Date($date);
  524.         }
  525.         
  526.         $this->_dates[$internalName]        &$date;
  527.         $this->_titles['C'][$internalName]  $title;
  528.         array_push($this->_internalNames$internalName);
  529.     }
  530.     
  531.    /**
  532.     * Add a localized translation for a holiday's title
  533.     *
  534.     * @access   protected
  535.     * @param    string  $internalName   internal name of an existing holiday
  536.     * @param    string  $locale         locale setting that shall be used by this method
  537.     * @param    string  $title          title
  538.     * @return   true on success, otherwise a PEAR_Error object
  539.     * @throws   object PEAR_Error       DATE_HOLIDAYS_INVALID_INTERNAL_NAME
  540.     */
  541.     function _addTranslationForHoliday($internalName$locale$title)
  542.     {
  543.         if (in_array($internalName$this->_internalNames)) {
  544.                 'Couldn\'t add translation (' $locale ') for holiday with this internal name: ' $internalName);
  545.         }
  546.         
  547.         if (in_array($locale$this->_availableLocales)) {
  548.             array_push($this->_availableLocales$locale);
  549.         }
  550.         $this->_titles[$locale][$internalName]  $title;
  551.         return true;
  552.     }
  553.     
  554.    /**
  555.     * Add a translation-file's content
  556.     * 
  557.     * The translation-file's content will be parsed and translations for
  558.     * holidays will be made available with the specified locale.
  559.     * 
  560.     * @access   public
  561.     * @param    string  $file   filename of the language file
  562.     * @param    string  $locale locale-code of the translation
  563.     * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  564.     * @throws   object PEAR_Errorstack
  565.     */
  566.     function addTranslationFile($file$locale)
  567.     {
  568.         if (file_exists($file)) {
  569.             Date_Holidays::raiseError(DATE_HOLIDAYS_LANGUAGEFILE_NOT_FOUND'Language-file not found');
  570.             return Date_Holidays::getErrorStack();
  571.         }
  572.         
  573.         $content    parse_ini_file($file);
  574.         foreach ($content as $internalName => $translation{
  575.             $this->_addTranslationForHoliday($internalName$locale$translation);
  576.         }
  577.         
  578.         if (Date_Holidays::errorsOccurred()) {
  579.             return Date_Holidays::getErrorStack();
  580.         }
  581.         return true;
  582.     }
  583.     
  584.    /**
  585.     * Remove a holiday from internal storage
  586.     *
  587.     * This method should be used within driver classes to unset holidays that were inherited from
  588.     * parent-drivers
  589.     *
  590.     * @access   protected
  591.     * @param    $string     $internalName   internal name
  592.     * @return   boolean     true on success, otherwise a PEAR_Error object
  593.     * @throws   object PEAR_Error   DATE_HOLIDAYS_INVALID_INTERNAL_NAME
  594.     */
  595.     function _removeHoliday($internalName)
  596.     {
  597.         if (in_array($internalName$this->_internalNames)) {
  598.                 'Couldn\'t remove holiday with this internal name: ' $internalName);
  599.         }
  600.         
  601.         if (isset($this->_dates[$internalName])) {
  602.             unset($this->_dates[$internalName]);
  603.         }
  604.         $locales    array_keys($this->_titles);
  605.         foreach ($locales as $locale{
  606.             if (isset($this->_titles[$locale][$internalName])) {
  607.                 unset($this->_titles[$locale][$internalName]);
  608.             }
  609.         }
  610.         $index      array_search($internalName$this->_internalNames);
  611.         if (is_null($index)) {
  612.             unset($this->_internalNames[$index]);
  613.         }
  614.         return true;
  615.     }
  616.     
  617.    /**
  618.     * Finds the best internally available locale for the specified one
  619.     *
  620.     * @access   protected
  621.     * @param    string  $locale locale
  622.     * @return   string  best locale available
  623.     */
  624.     function _findBestLocale($locale)
  625.     {
  626.         /* exact locale is available */
  627.         if (in_array($locale$this->_availableLocales)) {
  628.             return $locale;
  629.         }
  630.         
  631.         /* first two letter are equal */
  632.         foreach ($this->_availableLocales as $aLocale{
  633.             if (strncasecmp($aLocale$locale2== 0{
  634.                 return $aLocale;
  635.             }
  636.         }
  637.         
  638.         /* no appropriate locale available, will use driver's internal locale */
  639.         return 'C';
  640.     }
  641.     
  642.    /**
  643.     * Returns date of a holiday
  644.     *
  645.     * @access   public
  646.     * @param    string  $internalName   internal name for holiday
  647.     * @return   object Date             date of the holiday as PEAR::Date object on success, otherwise a PEAR_Error object
  648.     * @throws   object PEAR_Error       DATE_HOLIDAYS_INVALID_INTERNAL_NAME, DATE_HOLIDAYS_DATE_UNAVAILABLE
  649.     */
  650.     function getHolidayDate($internalName)
  651.     {
  652.         if (in_array($internalName$this->_internalNames)) {
  653.             return Date_Holidays::raiseError(DATE_HOLIDAYS_INVALID_INTERNAL_NAME'Invalid internal name: ' $internalName);
  654.         }
  655.         
  656.         if (isset($this->_dates[$internalName])) {
  657.             return Date_Holidays::raiseError(DATE_HOLIDAYS_DATE_UNAVAILABLE'Date for holiday with internal name ' $internalName 
  658.                 ' is not available');
  659.         }
  660.         
  661.         return $this->_dates[$internalName];
  662.     }
  663.     
  664.    /**
  665.     * Returns dates of all holidays or those specififed in $restrict array
  666.     *
  667.     * Structure of the returned array:
  668.     * <pre>
  669.     * array(
  670.     *   'internalNameFoo' => object of type date,
  671.     *   'internalNameBar' => object of type date
  672.     * )
  673.     * </pre>
  674.     *
  675.     * @access   public
  676.     * @param    array   $restrict   internal names of desired holidays
  677.     * @return   array with holidays' dates on success, otherwise a PEAR_Error object
  678.     * @throws   object PEAR_Error   DATE_HOLIDAYS_INVALID_INTERNAL_NAME
  679.     * @uses     getHolidayDate()
  680.     */
  681.     function getHolidayDates($restrict = array())
  682.     {
  683.         if (empty($restrict)) {
  684.             $restrict               $this->_internalNames;
  685.         }
  686.         
  687.         $dates                      =   array();
  688.         foreach ($restrict as $internalName{
  689.             $date                   &$this->getHolidayDate($internalName);
  690.             if (Date_Holidays::isError($date)) {
  691.                 return $date;
  692.             }
  693.             $dates[$internalName]   &$this->getHolidayDate($internalName);
  694.         }
  695.         return $dates;
  696.     }
  697.     
  698.    /**
  699.     * Sets the driver's locale
  700.     *
  701.     * @access   public
  702.     * @param    string  $locale locale
  703.     */
  704.     function setLocale($locale)
  705.     {
  706.         $this->_locale  =   $locale;
  707.     }
  708. }
  709. ?>

Documentation generated on Mon, 11 Mar 2019 13:54:58 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.