예제 #1
0
 function handle()
 {
     $text = $_REQUEST['text'];
     if (!$text) {
         $text = "今日の腐さん";
     }
     if (!$text || !is_string($text)) {
         throw new Exception('No text');
     }
     if (mb_strlen($text) > self::TEXT_LIMIT) {
         throw new Exception('Too long text');
     }
     $shokos = new VolatileTwitShokos();
     $rate = $shokos->evaluateLikelihood($text);
     $this->assign('rate', $rate);
     $this->assign('text', htmlspecialchars($text));
     $this->assign('status', 'ok');
 }