daysAfter -> daysNext, daysBefore -> daysPrev
authorChristian Weiske <cweiske@cweiske.de>
Thu, 13 Feb 2014 05:49:03 +0000 (06:49 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Thu, 13 Feb 2014 05:49:03 +0000 (06:49 +0100)
src/bdrem/Event.php
src/bdrem/Source/Bdf.php
src/bdrem/UserInterface.php

index 43b9c92..29585e7 100644 (file)
@@ -66,7 +66,7 @@ class Event
      *
      * @return boolean True if the event's date is within the given range
      */
-    public function isWithin($strDate, $nDaysBefore, $nDaysAfter)
+    public function isWithin($strDate, $nDaysPrev, $nDaysNext)
     {
         $this->refDate = $strDate;
         list($rYear, $rMonth, $rDay) = explode('-', $strDate);
@@ -104,9 +104,9 @@ class Event
         }
 
         if ($nDiff > 0) {
-            return $nDiff <= $nDaysAfter;
+            return $nDiff <= $nDaysNext;
         } else {
-            return -$nDiff <= $nDaysBefore;
+            return -$nDiff <= $nDaysPrev;
         }
 
         return false;
index e8208eb..f38e30f 100644 (file)
@@ -21,7 +21,7 @@ class Source_Bdf
     /**
      * @param string $strDate Date the events shall be found for, YYYY-MM-DD
      */
-    public function getEvents($strDate, $nDaysBefore, $nDaysAfter)
+    public function getEvents($strDate, $nDaysPrev, $nDaysNext)
     {
         $x = simplexml_load_file($this->filename);
 
@@ -38,7 +38,7 @@ class Source_Bdf
                 (string) $xPerson->event,
                 $date
             );
-            if ($event->isWithin($strDate, $nDaysBefore, $nDaysAfter)) {
+            if ($event->isWithin($strDate, $nDaysPrev, $nDaysNext)) {
                 $arEvents[] = $event;
             }
         }
index cd9f702..e4f7168 100644 (file)
@@ -18,7 +18,7 @@ abstract class UserInterface
 
         $arEvents = $source->getEvents(
             $this->config->date,
-            $this->config->daysBefore, $this->config->daysAfter
+            $this->config->daysPrev, $this->config->daysNext
         );
         usort($arEvents, '\\bdrem\\Event::compare');
         $this->render($arEvents);
@@ -31,10 +31,10 @@ abstract class UserInterface
         $parser->version = '0.1.0';
 
         $parser->addOption(
-            'daysAfter',
+            'daysNext',
             array(
-                'short_name'  => '-a',
-                'long_name'   => '--days-after',
+                'short_name'  => '-n',
+                'long_name'   => '--days-next',
                 'description' => 'Show NUM days after date',
                 'help_name'   => 'NUM',
                 'action'      => 'StoreInt',
@@ -42,10 +42,10 @@ abstract class UserInterface
             )
         );
         $parser->addOption(
-            'daysBefore',
+            'daysPrev',
             array(
-                'short_name'  => '-b',
-                'long_name'   => '--days-before',
+                'short_name'  => '-p',
+                'long_name'   => '--previous',
                 'description' => 'Show NUM days before date',
                 'help_name'   => 'NUM',
                 'action'      => 'StoreInt',
@@ -86,10 +86,10 @@ abstract class UserInterface
         try {
             $result = $parser->parse();
             // do something with the result object
-            $this->config->daysAfter  = $result->options['daysAfter'];
-            $this->config->daysBefore = $result->options['daysBefore'];
-            $this->config->renderer   = $result->options['renderer'];
-            $this->config->quiet      = $result->options['quiet'];
+            $this->config->daysNext = $result->options['daysNext'];
+            $this->config->daysPrev = $result->options['daysPrev'];
+            $this->config->renderer = $result->options['renderer'];
+            $this->config->quiet    = $result->options['quiet'];
         } catch (\Exception $exc) {
             $this->preRenderParameterError();
             $parser->displayError($exc->getMessage());