add Dependencies and Routes classes
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Lexi / Zoe 2020-06-28 19:26:59 +02:00
parent c344dce8eb
commit 7cc2d40660
Signed by: binaryDiv
GPG key ID: F8D4956E224DA232
6 changed files with 288 additions and 12 deletions

29
src/Dependencies.php Normal file
View file

@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace NoteCat;
use DI\Container;
use Psr\Container\ContainerInterface;
class Dependencies
{
public static function createContainer(): Container
{
$container = new Container();
// Controllers
$container->set(HelloWorldController::class, function (ContainerInterface $c) {
return new HelloWorldController(
$c->get(HelloWorld::class)
);
});
// Services
$container->set(HelloWorld::class, function () {
return new HelloWorld();
});
return $container;
}
}