Source for file TwoDigitYearStringParser.class.php

Documentation is available at TwoDigitYearStringParser.class.php

  1. <?php
  2. /**
  3. * @since 5/24/05
  4. * @package harmoni.primitives.chronology.string_parsers
  5. *
  6. * @copyright Copyright &copy; 2005, Middlebury College
  7. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  8. *
  9. * @version $Id: TwoDigitYearStringParser.class.php,v 1.2 2006/06/26 12:55:08 adamfranco Exp $
  10. *
  11. * @link http://harmoni.sourceforge.net/
  12. * @author Adam Franco <adam AT adamfranco DOT com> <afranco AT middlebury DOT edu>
  13. */
  14.  
  15. require_once(dirname(__FILE__)."/StringParser.class.php");
  16. //require_once(dirname(__FILE__)."/RegexStringParser.class.php");
  17.  
  18.  
  19. /**
  20. * This class implements a method for converting from a two-digit year, such as
  21. * '82' to the four-digit '1982' equivalent. Due to the lack of information
  22. * contained in a two-digit year, the only valid years are 1970-2069.
  23. *
  24. * This class extends RegexStringParser only as a matter of convenience as its
  25. * decendents at the time of this refactoring all were decendents of
  26. * RegexStringParser.
  27. *
  28. * @since 5/24/05
  29. * @package harmoni.primitives.chronology.string_parsers
  30. *
  31. * @copyright Copyright &copy; 2005, Middlebury College
  32. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  33. *
  34. * @version $Id: TwoDigitYearStringParser.class.php,v 1.2 2006/06/26 12:55:08 adamfranco Exp $
  35. *
  36. * @link http://harmoni.sourceforge.net/
  37. * @author Adam Franco <adam AT adamfranco DOT com> <afranco AT middlebury DOT edu>
  38. */
  39. class TwoDigitYearStringParser
  40. extends RegexStringParser
  41. {
  42.  
  43. /*******************************************************
  44. * Instance Methods - Setting (private
  45. *********************************************************/
  46.  
  47. /**
  48. * Set the year
  49. *
  50. * @param integer $anInteger
  51. * @return void
  52. * @access private
  53. * @since 5/24/05
  54. */
  55. function setYear ( $anInteger ) {
  56. if ($anInteger > 70 && $anInteger < 100)
  57. $this->year = intval(1900 + $anInteger);
  58. else if ($anInteger < 100)
  59. $this->year = intval(2000 + $anInteger);
  60. else
  61. $this->year = $anInteger;
  62. }
  63. }
  64.  
  65. ?>

Documentation generated on Wed, 19 Sep 2007 10:27:34 -0400 by phpDocumentor 1.3.0RC3