Esempio n. 1
0
 /**
  * The onNewVisit method is triggered when a new visitor is detected. This means here you can define an initial
  * value for this user. By returning boolean false no value will be saved. Once the user makes another action the
  * event "onExistingVisit" is executed. That means for each visitor this method is executed once. If you do not want
  * to perform any action on a new visit you can just remove this method.
  *
  * @param Request $request
  * @param Visitor $visitor
  * @param Action|null $action
  * @return mixed|false
  */
 public function onNewVisit(Request $request, Visitor $visitor, $action)
 {
     $localDate = \DateTime::CreateFromFormat("H:i:s", $request->getLocalTime());
     $isOddHour = HourParity\isOddHour($localDate);
     if ($isOddHour) {
         return 1;
     }
     return 0;
 }
 /**
  * 
  */
 public function testRecognizeOddHour()
 {
     $localDate = \DateTime::CreateFromFormat("H:i:s", "13:23:32");
     $isOddHour = HourParity\isOddHour($localDate);
     $this->assertTrue($isOddHour);
 }