szurubooru/src/Bootstrap.php

41 lines
770 B
PHP
Raw Normal View History

2014-10-02 19:19:55 +02:00
<?php
namespace Szurubooru;
$startTime = microtime(true);
2014-10-02 19:19:55 +02:00
final class Bootstrap
{
private static $startTime;
public static function init($startTime)
2014-10-02 19:19:55 +02:00
{
self::$startTime = $startTime;
2014-10-02 19:19:55 +02:00
self::turnErrorsIntoExceptions();
self::initAutoloader();
}
public static function getStartTime()
{
return self::$startTime;
}
2014-10-02 19:19:55 +02:00
private static function initAutoloader()
{
require(__DIR__
. DIRECTORY_SEPARATOR . '..'
. DIRECTORY_SEPARATOR . 'vendor'
. DIRECTORY_SEPARATOR . 'autoload.php');
}
private static function turnErrorsIntoExceptions()
{
set_error_handler(
function($errno, $errstr, $errfile, $errline, array $errcontext)
{
throw new \ErrorException($errstr, 0, $errno, $errfile, $errline);
});
}
}
Bootstrap::init($startTime);