handle() public method

Once we have the visitor information, we have to determine if the visit is a new or a known visit. 1) When the last action was done more than 30min ago, or if the visitor is new, then this is a new visit. 2) If the last action is less than 30min ago, then the same visit is going on. Because the visit goes on, we can get the time spent during the last action. NB: - In the case of a new visit, then the time spent during the last action of the previous visit is unknown. - In the case of a new visit but with a known visitor, we can set the 'returning visitor' flag. In all the cases we set a cookie to the visitor with the new information.
public handle ( )
Example #1
0
 private function prepareVisitWithRequest($requestParams, $requestDate)
 {
     $request = new Request($requestParams);
     $request->setCurrentTimestamp(Date::factory($requestDate)->getTimestamp());
     $visit = new Visit();
     $visit->setRequest($request);
     $visit->handle();
     return array($visit, $request);
 }