src/Controller/LuckyController.php line 17
<?php
// src/Controller/LuckyController.php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class LuckyController extends AbstractController
{
#[Route('/lucky/number/{min}/{max}')]
#[Route('/')]
#[Route('/index')]
#[Route('/index.html')]
#[Route('/index.php')]
#[Route('/index.htm')]
public function number(int $min = 1, int $max = 6): Response
{
if ($max < $min)
{
// swap
$tmp = $max;
$max = $min;
$min = $tmp;
}
// min and max are both inclusive
$number = random_int($min, $max);
return new Response(
'<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<title>Karlsson</title>
<body>
<p>Page under construction. Reload to have a new number.</p>
<p>Dice show: '.$number.'</p>
</body>
</html>'
);
}
}