/** * @Route("/", name="homepage") */ public function homepage() { $shipLoader = new ShipLoader(); $ships = $shipLoader->getShips(); $html = $this->container->get('twig')->render('ship/homepage.twig', array('ships' => $ships)); return new Response($html); }
/** * Returns 2 random ships for battle * * @return NormalShip[] */ public function getRandomShips() { $ships = $this->shipLoader->getShips(); $key = array_rand($ships); $shipA = $ships[$key]; unset($ships[$key]); $key = array_rand($ships); $shipB = $ships[$key]; return array($shipA, $shipB); }