Initial commit, framework/frontend assets setup

This commit is contained in:
Maarten 2024-11-25 18:59:11 +01:00
commit 9d9858bb37
32 changed files with 4651 additions and 0 deletions

View file

@ -0,0 +1,55 @@
<?php
namespace Core\Exceptions;
use Throwable;
use Whoops\Handler\PrettyPageHandler;
use Whoops\Run as Whoops;
class Exceptions
{
/**
* Exceptions handler instance
*
* @var Whoops
*/
private static Whoops $instance;
/**
* Get exceptions handler instance
*
* @return \Whoops\Run
*/
public static function handler(): Whoops
{
if (!isset(self::$instance)) {
$instance = new Whoops();
$instance->pushHandler(new PrettyPageHandler());
self::$instance = $instance;
}
return self::$instance;
}
/**
* Catch all exceptions
*
* @return void
*/
public static function catch(): void
{
self::handler()->register();
}
/**
* Catch single exception
*
* @param \Throwable $exception
* @return void
*/
public static function catchOne(Throwable $exception): void
{
self::handler()->handleException($exception);
}
}