Passed
Push — master ( 4a146d...3e1455 )
by Peter
02:17
created

PageCategoryLoaderBootstrapper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 24
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getBindings() 0 4 1
A registerBindings() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AbterPhp\Website\Bootstrappers\Template;
6
7
use AbterPhp\Website\Databases\Queries\PageCategoryCache;
8
use AbterPhp\Website\Orm\PageRepo;
9
use AbterPhp\Website\Template\Builder\PageCategory;
10
use AbterPhp\Website\Template\PageCategoryLoader;
11
use Opulence\Ioc\Bootstrappers\Bootstrapper;
12
use Opulence\Ioc\Bootstrappers\ILazyBootstrapper;
13
use Opulence\Ioc\IContainer;
14
15
class PageCategoryLoaderBootstrapper extends Bootstrapper implements ILazyBootstrapper
16
{
17
    /**
18
     * @return array
19
     */
20
    public function getBindings(): array
21
    {
22
        return [
23
            PageCategoryLoader::class,
24
        ];
25
    }
26
27
    /**
28
     * @param IContainer $container
29
     */
30
    public function registerBindings(IContainer $container)
31
    {
32
        $pageCategoryCache = $container->resolve(PageCategoryCache::class);
33
        $pageRepo          = $container->resolve(PageRepo::class);
34
        $builder           = $container->resolve(PageCategory::class);
35
36
        $loader = new PageCategoryLoader($pageRepo, $pageCategoryCache, $builder);
37
38
        $container->bindInstance(PageCategoryLoader::class, $loader);
39
    }
40
}
41