Update Framework

This commit is contained in:
Maarten 2019-12-23 18:55:25 +01:00
parent 06f17dff5b
commit 69f3313f0f
19 changed files with 974 additions and 35 deletions

View file

@ -0,0 +1,47 @@
<?php
namespace Runtime\Factory;
use ClassNotFoundException;
use Pecee\SimpleRouter\SimpleRouter;
use Runtime\Exceptions\ExceptionHandler;
class BootstrapFactory {
public function handle()
{
SimpleRouter::setDefaultNamespace('\App\Http\Controllers');
require_once('../routes/web.php ');
try {
SimpleRouter::start();
}
catch (\Exception $e) {
ExceptionHandler::make($e);
}
}
/**
* @param $abstract
* @return mixed
*/
public function make($abstract)
{
return $this->resolve($abstract);
}
/**
* @param $abstract
* @return mixed|null
*/
private function resolve($abstract) {
if(class_exists($abstract)) {
return new $abstract;
}
ExceptionHandler::make(ClassNotFoundException::class);
return null;
}
}