class Kernel extends SymfonyKernel implements EventSubscriberInterface
{
use MicroKernelTrait;
public function bowtiesAction(): Response
{
return new RedirectResponse('I wear a fez now. Fezzes are cool!');
}
public function dangerousAction(): Response
{
throw new Danger('π₯π₯ ππ· π±πΊ π₯π₯');
}
public function onKernelException(ExceptionEvent $event): void
{
if ($event->getThrowable() instanceof Danger) {
$event->setResponse(new Response("π΄π»: It's dangerous to go alone. Take this: π‘οΈ"));
}
}
protected function configureRoutes(RoutingConfigurator $routes): void
{
$routes->add('bowties', '/bowties')->controller('kernel::bowtiesAction');
$routes->add('danger', '/danger')->controller('kernel::dangerousAction');
}
public static function getSubscribedEvents(): array
{
return [KernelEvents::EXCEPTION => 'onKernelException'];
}
}
ogizanagi/ogizanagi
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Β | Β | |||
Repository files navigation
About
π