/**
  * Summary.
  *
  * @since  0.9.0
  * @see
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  * @param \Silex\Application                        $app
  *
  * @return JsonResponse
  * @author nguyenvanduocit
  */
 public function post(Request $request, Application $app)
 {
     $sign = $request->get('sign');
     $sign = strtolower($sign);
     if (!$sign) {
         $errorResponse = new Response();
         $errorResponse->setErrorCode('100');
         $errorResponse->setText('Your have to provice the sign.');
         return new JsonResponse($errorResponse);
     }
     if (!array_key_exists($sign, $this->dailyEndPoint)) {
         $errorResponse = new Response();
         $errorResponse->setErrorCode('101');
         $errorResponse->setText('Your sign is not exist. What planet are you come from?');
         return new JsonResponse($errorResponse);
     }
     $response = new AttachmentResponse();
     $holoscope = $this->getDailyHoroscope($sign);
     $response->setText($holoscope->getContent());
     $response->setThumbUrl($holoscope->getImageURL());
     $response->setTitle($holoscope->getName());
     // Set Field
     $fields = $holoscope->getRating();
     array_walk($fields, function (&$item) {
         $item['short'] = 'true';
     });
     $response->setFields($fields);
     return new JsonResponse($response);
 }
 /**
  * Summary.
  *
  * @since  0.9.0
  * @see
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  * @param \Silex\Application                        $app
  *
  * @return JsonResponse
  * @author nguyenvanduocit
  */
 public function post(Request $request, Application $app)
 {
     $category = $request->get('category', 'all');
     /**
      * Todo support another fact
      */
     $response = new AttachmentResponse();
     if ($category === 'programming') {
         $data = $this->getRandomFactOfProgramming();
         $response->setTitle($data['title']);
         $response->setTitleLink('http://laptrinh.senviet.org');
         $response->setImageUrl($data['image_url']);
     } else {
         $categorylist = implode(', ', array_keys($this->images));
         $response->setText('I don\'t know about this category, I only know abount ' . $categorylist);
     }
     return new JsonResponse($response);
 }