still wip
This commit is contained in:
parent
d21ca3e6ab
commit
9be884c8e4
12 changed files with 261 additions and 39 deletions
|
|
@ -4,7 +4,55 @@
|
|||
namespace Venom;
|
||||
|
||||
|
||||
use Venom\Views\RenderController;
|
||||
use Venom\Views\VenomRenderer;
|
||||
|
||||
class Venom
|
||||
{
|
||||
private VenomRenderer $renderer;
|
||||
private array $controllers = [];
|
||||
private array $modules = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->renderer = new VenomRenderer($this);
|
||||
}
|
||||
|
||||
public function run(): void
|
||||
{
|
||||
// we need to load the current controller and the current start template.
|
||||
// after this we can start the renderer
|
||||
$this->renderer->init(null);
|
||||
$this->renderer->render();
|
||||
}
|
||||
|
||||
public function initModules(array $modules): void
|
||||
{
|
||||
foreach ($modules as $key => $moduleClass) {
|
||||
$module = new $moduleClass;
|
||||
if ($module instanceof Module && $module->register()) {
|
||||
$this->modules[$key] = $module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function initControllers(array $controllers): void
|
||||
{
|
||||
foreach ($controllers as $key => $controllerClass) {
|
||||
$controller = new $controllerClass;
|
||||
if ($controller instanceof RenderController && $controller->register()) {
|
||||
$this->controllers[$key] = $controller;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function prepare()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private function findController()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue