Example #1
0
 protected function processRequest()
 {
     if (is_null($this->request)) {
         $this->request = $this->getNextRequest();
     }
     if (!is_null($this->request)) {
         if ($this->atFloor($this->request->getFloor())) {
             $this->goingTarget = true;
             $this->go($this->request->getTarget());
         } elseif ($this->goingTarget) {
             if ($this->atFloor($this->request->getTarget())) {
                 $this->stop();
                 $this->request = null;
                 $this->goingTarget = false;
             }
         } else {
             $this->goingTarget = false;
             $this->go($this->request->getFloor());
         }
     }
 }
Example #2
0
 /**
  * Is called if an error is caught while running the delivery
  *
  * @param Request $request
  * @param \Exception $exception
  * @return mixed
  */
 protected function error(Request $request, \Exception $exception)
 {
     return $request->getTarget() . ' threw ' . get_class($exception) . ': ' . $exception->getMessage() . "\n" . $exception->getTraceAsString();
 }