1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace AbterPhp\Website\Bootstrappers\Template\Loader; |
6
|
|
|
|
7
|
|
|
use AbterPhp\Website\Databases\Queries\ContentListCache as Cache; |
8
|
|
|
use AbterPhp\Website\Orm\ContentListItemRepo as ItemRepo; |
9
|
|
|
use AbterPhp\Website\Orm\ContentListRepo as Repo; |
10
|
|
|
use AbterPhp\Website\Template\Builder\ContentList\DefinitionList as DefinitionListBuilder; |
11
|
|
|
use AbterPhp\Website\Template\Builder\ContentList\Simple as SimpleBuilder; |
12
|
|
|
use AbterPhp\Website\Template\Builder\ContentList\WithImage as WithImageBuilder; |
13
|
|
|
use AbterPhp\Website\Template\Loader\ContentList as Loader; |
14
|
|
|
use Opulence\Ioc\Bootstrappers\Bootstrapper; |
15
|
|
|
use Opulence\Ioc\Bootstrappers\ILazyBootstrapper; |
16
|
|
|
use Opulence\Ioc\IContainer; |
17
|
|
|
|
18
|
|
|
class ContentListBootstrapper extends Bootstrapper implements ILazyBootstrapper |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* @return array |
22
|
|
|
*/ |
23
|
|
|
public function getBindings(): array |
24
|
|
|
{ |
25
|
|
|
return [ |
26
|
|
|
Loader::class, |
27
|
|
|
]; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @param IContainer $container |
32
|
|
|
*/ |
33
|
|
|
public function registerBindings(IContainer $container) |
34
|
|
|
{ |
35
|
|
|
$repo = $container->resolve(Repo::class); |
36
|
|
|
$itemRepo = $container->resolve(ItemRepo::class); |
37
|
|
|
$cache = $container->resolve(Cache::class); |
38
|
|
|
|
39
|
|
|
/** @var DefinitionListBuilder $definitionListBuilder */ |
40
|
|
|
$definitionListBuilder = $container->resolve(DefinitionListBuilder::class); |
41
|
|
|
|
42
|
|
|
/** @var SimpleBuilder $simpleBuilder */ |
43
|
|
|
$simpleBuilder = $container->resolve(SimpleBuilder::class); |
44
|
|
|
|
45
|
|
|
/** @var WithImageBuilder $withImageBuilder */ |
46
|
|
|
$withImageBuilder = $container->resolve(WithImageBuilder::class); |
47
|
|
|
|
48
|
|
|
$builders = [ |
49
|
|
|
$definitionListBuilder->getIdentifier() => $definitionListBuilder, |
50
|
|
|
$simpleBuilder->getIdentifier() => $simpleBuilder, |
51
|
|
|
$withImageBuilder->getIdentifier() => $withImageBuilder, |
52
|
|
|
]; |
53
|
|
|
|
54
|
|
|
$loader = new Loader($repo, $itemRepo, $cache, $builders); |
55
|
|
|
|
56
|
|
|
$container->bindInstance(Loader::class, $loader); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|