public function showAction(Request $request, $period = null)
 {
     $highFives = $this->highFiveRepository->getUserStats(new Period($period, $request->attributes->all()));
     $chart = $this->chartDrawer->draw($highFives);
     //catch the image
     ob_start();
     $chart->Stroke();
     $image_data = ob_get_contents();
     ob_end_clean();
     return new Response($image_data, 200, ['Content-Type' => 'image/png', 'Content-Disposition' => 'inline; filename="chart.png"']);
 }
 public function receiveMessage(MessageEvent $event)
 {
     $message = $event->getMessage();
     try {
         if ($this->highFiveRepository->getMatch($message->getCreatedAt(), $message->getUser()->getId())) {
             return false;
         }
         $highFive = $this->highFiveMapper->getHighFive($message);
         $this->em->persist($highFive);
     } catch (\Exception $e) {
         return false;
     }
 }