add microformats2 markup to html table
[bdrem.git] / src / bdrem / Source / Bdf.php
index e8208ebce5bd24e79df6763a2f3c98c21f0e793a..651360a0e1fe2e042aeb28536a5b55f1710412a7 100644 (file)
@@ -1,13 +1,41 @@
 <?php
+/**
+ * Part of bdrem
+ *
+ * PHP version 5
+ *
+ * @category  Tools
+ * @package   Bdrem
+ * @author    Christian Weiske <cweiske@cweiske.de>
+ * @copyright 2014 Christian Weiske
+ * @license   http://www.gnu.org/licenses/agpl.html GNU AGPL v3
+ * @link      http://cweiske.de/bdrem.htm
+ */
 namespace bdrem;
 
 /**
  * Reads birthday reminder 2's birthday files (.bdf).
+ *
+ * @category  Tools
+ * @package   Bdrem
+ * @author    Christian Weiske <cweiske@cweiske.de>
+ * @copyright 2014 Christian Weiske
+ * @license   http://www.gnu.org/licenses/agpl.html GNU AGPL v3
+ * @link      http://cweiske.de/bdrem.htm
  */
 class Source_Bdf
 {
+    /**
+     * Full path of bdf birthday file
+     * @var string
+     */
     protected $filename;
 
+    /**
+     * Set the birthday file name
+     *
+     * @param string $filename Path to bdf file
+     */
     public function __construct($filename)
     {
         $this->filename = $filename;
@@ -19,9 +47,16 @@ class Source_Bdf
     }
 
     /**
-     * @param string $strDate Date the events shall be found for, YYYY-MM-DD
+     * Return all events for the given date range
+     *
+     * @param string  $strDate       Date the events shall be found for,
+     *                               YYYY-MM-DD
+     * @param integer $nDaysPrevious Include number of days before $strDate
+     * @param integer $nDaysNext     Include number of days after $strDate
+     *
+     * @return Event[] Array of matching event objects
      */
-    public function getEvents($strDate, $nDaysBefore, $nDaysAfter)
+    public function getEvents($strDate, $nDaysPrevious, $nDaysNext)
     {
         $x = simplexml_load_file($this->filename);
 
@@ -38,7 +73,7 @@ class Source_Bdf
                 (string) $xPerson->event,
                 $date
             );
-            if ($event->isWithin($strDate, $nDaysBefore, $nDaysAfter)) {
+            if ($event->isWithin($strDate, $nDaysPrevious, $nDaysNext)) {
                 $arEvents[] = $event;
             }
         }