|
@@ -4,22 +4,26 @@
|
|
|
* format: [y]ymdd
|
|
|
* 4-characters until 2009-12-31, 5 afterwards
|
|
|
*
|
|
|
- * $Id: u_date_code.php,v 1.3 2007-04-29 15:40:29 marand Exp $
|
|
|
+ * @copyright (c) 2007 OSI
|
|
|
+ * @author Frédéric G. MARAND
|
|
|
+ * @license Licensed under the CeCILL 2.0
|
|
|
+ * @version CVS: $Id: u_date_code.php,v 1.4 2007-06-03 21:25:47 marand Exp $
|
|
|
+ * @link
|
|
|
+ * @since Not applicable yet
|
|
|
+ * @package default
|
|
|
*/
|
|
|
|
|
|
-require_once('misc.php');
|
|
|
require_once('boxed_scalars.php');
|
|
|
|
|
|
-class osinet_date_code implements iComparable
|
|
|
+class osinet_date_code implements Comparable_Interface
|
|
|
{
|
|
|
private $f_value;
|
|
|
|
|
|
|
|
|
- * Implements iComparable restrictively, only comparing to other osinet_date_code
|
|
|
- * objects, not to any other class implementing iComparable
|
|
|
- *
|
|
|
+ * Implements Comparable_Interface restrictively, only comparing to other osinet_date_code objects, not to any other class implementing Comparable_Interface
|
|
|
+ * @return int
|
|
|
*/
|
|
|
- public function cmp(iComparable $other)
|
|
|
+ public function cmp(Comparable_Interface $other)
|
|
|
{
|
|
|
if (!($other instanceof osinet_date_code))
|
|
|
throw new Exception('osinet_date_code only compares to other osinet_date_code objects');
|
|
@@ -73,6 +77,9 @@ class osinet_date_code implements iComparable
|
|
|
return $ret;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * @param int $time
|
|
|
+ */
|
|
|
public function __construct($time = null)
|
|
|
{
|
|
|
date_default_timezone_set('Europe/Paris');
|
|
@@ -88,6 +95,9 @@ class osinet_date_code implements iComparable
|
|
|
$this->f_value = sprintf('%d%s%02d', $year, $month, $day);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * @param string $date_code
|
|
|
+ */
|
|
|
private function set_value($date_code)
|
|
|
{
|
|
|
$date_code = strtoupper($date_code);
|
|
@@ -101,6 +111,10 @@ class osinet_date_code implements iComparable
|
|
|
$this->f_value = $date_code;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * @param string $nm
|
|
|
+ * @return mixed
|
|
|
+ */
|
|
|
protected function __get($nm)
|
|
|
{
|
|
|
|
|
@@ -110,7 +124,12 @@ class osinet_date_code implements iComparable
|
|
|
return $this->f_value;
|
|
|
}
|
|
|
|
|
|
- private function __set($nm, $val)
|
|
|
+
|
|
|
+ * @param string $nm
|
|
|
+ * @param mixed $val
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+ protected function __set($nm, $val)
|
|
|
{
|
|
|
if ($nm <> 'value')
|
|
|
throw new Exception("$nm: undefined property for " . get_class($this));
|