Source for file creating_drivers.php
Documentation is available at creating_drivers.php
* Example how to create an own driver-class for Date_Holidays
* To test this class, you have to copy it into the drivers-directory.
* The classname has to be something like Date_Holidays_Driver_*.
* Otherwise it won't be compatible to be used within PEAR's strict directory
* @author Carsten Lucke <luckec@tool-garage.de>
* @license http://www.php.net/license/3_01.txt PHP License 3.0.1
* @link http://pear.php.net/package/Date_Holidays
* Use the Date_Holidays::factory() method to construct an object of a
* 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
* If your driver is extending another driver-class and is not a direct
* descendant of the Date_Holidays_Driver base-class you will want to
* build this classes' holidays before you start with your turn.
* So just call the _buildHolidays() method of that class.
* There are two methods to add a holiday. One for adding holidays in
* general and on that can be used to add static holidays (every year
* You always have to give the added holiday an unique internal name
* This should describe the holiday as good as possible.
* Of course you need a date and a title (the default title should
* You can add as many translations as you want for your driver's
* Although the default title is in English you should add another one
* with the correct locale setting.
* General method to add a holiday
'Circumcision of Jesus');
// if you are using helper methods to calculate movable holidays is
$fooDate = $this->_calcFirstMondayInJanuary ();
'First monday in January');
* Special method for adding static holidays:
$static = array ('newYearsDay' => array ('date' => '01-01',
'title' => 'New Year\'s Day'),
'valentinesDay' => array ('date' => '02-14',
'title' => 'Valentine\'s Day'));
* @return object Date date of first monday in actual years january
function _calcFirstMondayInJanuary ()
$date = new Date ($this->_year . '-01-01');
while ($date->getDayOfWeek () != 1 ) {
$date = $date->getNextDay ();
Documentation generated on Mon, 11 Mar 2019 15:52:28 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|