Exemplo 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());
     $isEvenHour = HourParity\isEvenHour($localDate);
     if ($isEvenHour) {
         return 1;
     }
     return 0;
 }
 /**
  * 
  */
 public function testRecognizeEvenHour()
 {
     $localDate = \DateTime::CreateFromFormat("H:i:s", "10:23:32");
     $isEvenHour = HourParity\isEvenHour($localDate);
     $this->assertTrue($isEvenHour);
 }