-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·40 lines (29 loc) · 1.07 KB
/
index.php
File metadata and controls
executable file
·40 lines (29 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
declare(strict_types=1);
use DI\DependencyInjection\ContainerBag;
use Services\Service1\Profiler;
use Services\Service2\AbstractService;
use DI\DependencyInjection\Container;
//require_once("customAutoload.php");
require_once 'vendor/autoload.php';
//
$container = new Container();
$container->set('service', function() {
return new stdClass();
});
var_dump($container->get('service'));
$container->set(Profiler::class);
var_dump($container->get(Profiler::class));
$container->set(Services\Service2\AbstractService::class, Services\Service2\Service::class);
var_dump($container->get(AbstractService::class));
$container->set(Services\Service2\AbstractService::class, Services\Service2\AnotherService::class);
var_dump($container->get(AbstractService::class));
$container->unset(Profiler::class);
var_dump($container);
$containerBag = new ContainerBag();
$containerBag[Profiler::class] = Profiler::class;
var_dump($containerBag[Profiler::class]);
$container = new Container();
$container->set(Profiler::class);
$profiler = $container->get(Profiler::class);
var_dump($profiler);