Browse Source

New naming and commenting conventions for FSM 1.7

Frederic G. Marand 17 years ago
parent
commit
762ba041e6
1 changed files with 27 additions and 8 deletions
  1. 27 8
      u_date_code.php

+ 27 - 8
u_date_code.php

@@ -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');          // needed for "iComparable" interface
 require_once('boxed_scalars.php'); // needed to sign-compare ints
 
-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)
     {
     // echo "osinet_date_code::__get($nm)\n";
@@ -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));