コード例 #1
0
ファイル: Game.php プロジェクト: wildalmighty/BattleShips
 /**
  * Get message for a status
  * @param int $status
  * @return string
  */
 protected function getMessageByStatus($status)
 {
     switch ($status) {
         case self::STATUS_FINISHED:
             return "Well done! You have destroyed all ships in {$this->board->getTries()} shots!";
         case self::STATUS_MISS:
             return "Missed!";
         case self::STATUS_HIT:
             return "Hit!";
         case self::STATUS_SUNK:
             return "Sunk!";
         default:
             return "Error! Try again?";
     }
 }