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

Source for file Holiday.php

Documentation is available at Holiday.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: Holiday.php,v 1.4 2005/12/22 21:10:14 luckec Exp $
  20.  
  21. /**
  22.  * Simple class that wraps a holiday's data
  23.  *
  24.  * @category Date
  25.  * @package  Date_Holidays
  26.  * @version  $Id: Holiday.php,v 1.4 2005/12/22 21:10:14 luckec Exp $
  27.  * @author   Carsten Lucke <luckec@tool-garage.de>
  28.  */
  29. {
  30.    /**
  31.     * Internal name
  32.     *
  33.     * @access   private
  34.     * @var      string 
  35.     */
  36.     var $_internalName;
  37.     
  38.    /**
  39.     * Title
  40.     *
  41.     * @access   private
  42.     * @var      string 
  43.     */
  44.     var $_title;
  45.     
  46.    /**
  47.     * Date
  48.     *
  49.     * @access   private
  50.     * @var      object Date 
  51.     */
  52.     var $_date;
  53.     
  54.    /**
  55.     * Additional holiday properties like a more detailed description, etc.
  56.     * 
  57.     * @access   private
  58.     * @var      array 
  59.     */
  60.     var $_properties;
  61.     
  62.    /**
  63.     * Constructor
  64.     *
  65.     * @access   public
  66.     * @param    string      $internalName   internal name
  67.     * @param    string      $title          title
  68.     * @param    object Date $date           date
  69.     * @param    array       properties for this holiday
  70.     */
  71.     function Date_Holidays_Holiday($internalName$title&$date$properties)
  72.     {
  73.         $this->_internalName $internalName;
  74.         $this->_title        $title;
  75.         $this->_date         = null;
  76.         $this->_properties   = array();
  77.         
  78.         if (is_a($date'Date')) {
  79.             $this->_date $date;
  80.         }
  81.         
  82.         if (is_array($properties)) {
  83.             $this->_properties   $properties;
  84.         }
  85.     }
  86.     
  87.    /**
  88.     * Returns the internal name
  89.     *
  90.     * @access   public
  91.     * @return   string  internal name
  92.     */
  93.     function getInternalName()
  94.     {
  95.         return $this->_internalName;
  96.     }
  97.     
  98.    /**
  99.     * Returns the title
  100.     *
  101.     * @access   public
  102.     * @return   string  title
  103.     */
  104.     function getTitle()
  105.     {
  106.         return $this->_title;
  107.     }
  108.     
  109.    /**
  110.     * Returns the date
  111.     *
  112.     * @access   public
  113.     * @return   object Date date
  114.     */
  115.     function getDate()
  116.     {
  117.         return $this->_date;
  118.     }
  119.     
  120.    /**
  121.     * Set the internal name
  122.     *
  123.     * @access   public
  124.     * @param    string  $internalName   internal name
  125.     */
  126.     function setInternalName($internalName)
  127.     {
  128.         $this->_internalName $internalName;
  129.     }
  130.     
  131.    /**
  132.     * Set the title
  133.     *
  134.     * @access   public
  135.     * @param    string  $title  title
  136.     */
  137.     function setTitle($title)
  138.     {
  139.         $this->_title $title;
  140.     }
  141.     
  142.    /**
  143.     * Set the date
  144.     *
  145.     * @access   public
  146.     * @param    object Date date
  147.     */
  148.     function setDate(&$date)
  149.     {
  150.         $this->_date $date;
  151.     }
  152.     
  153.    /**
  154.     * Returns the holiday data as an array.
  155.     *
  156.     * Format:
  157.     * <pre>
  158.     *   array(
  159.     *       'internalName'  => 'easter'
  160.     *       'title'         => 'Easter Sunday'
  161.     *       'date'          => Object of type Date
  162.     *   )
  163.     * </pre>
  164.     * 
  165.     * @access   public
  166.     * @return   array   holiday-data
  167.     */
  168.     function toArray()
  169.     {
  170.         $data                   = array();
  171.         $data['internalName']   $this->_internalName;
  172.         $data['title']          $this->_title;
  173.         $data['date']           $this->_date;
  174.         return $data;
  175.     }
  176.     
  177.    /**
  178.     * Returns the holidays additional properties that contain information like a more detailed description, etc.
  179.     * 
  180.     * @access   public
  181.     * @return   array   associative array with corresponding pairs of propertyName => $propertyValue
  182.     */
  183.     function getProperties(
  184.     {
  185.         return $this->_properties;
  186.     }
  187. }
  188. ?>

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