Passed
Push — master ( 8f0f73...d2306b )
by Peter
02:30
created

ContentListBootstrapper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A registerBindings() 0 27 1
A getBindings() 0 4 1
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\ContentListRepo as Repo;
9
use AbterPhp\Website\Template\Builder\ContentList\Natural as NaturalBuilder;
10
use AbterPhp\Website\Template\Builder\ContentList\Ordered as OrderedBuilder;
11
use AbterPhp\Website\Template\Builder\ContentList\Section as SectionBuilder;
12
use AbterPhp\Website\Template\Builder\ContentList\Unordered as UnorderedBuilder;
13
use AbterPhp\Website\Template\Loader\ContentListCategory as Loader;
0 ignored issues
show
Bug introduced by
The type AbterPhp\Website\Templat...der\ContentListCategory was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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
        $cache = $container->resolve(Cache::class);
36
        $repo  = $container->resolve(Repo::class);
37
38
        /** @var NaturalBuilder $naturalBuilder */
39
        $naturalBuilder = $container->resolve(NaturalBuilder::class);
40
41
        /** @var OrderedBuilder $orderedBuilder */
42
        $orderedBuilder = $container->resolve(OrderedBuilder::class);
43
44
        /** @var SectionBuilder $sectionBuilder */
45
        $sectionBuilder = $container->resolve(SectionBuilder::class);
46
47
        /** @var UnorderedBuilder $unorderedBuilder */
48
        $unorderedBuilder = $container->resolve(UnorderedBuilder::class);
49
50
        $builders = [
51
            $naturalBuilder->getIdentifier()   => $naturalBuilder,
52
            $orderedBuilder->getIdentifier()   => $orderedBuilder,
53
            $sectionBuilder->getIdentifier()   => $sectionBuilder,
54
            $unorderedBuilder->getIdentifier() => $unorderedBuilder,
55
        ];
56
57
        $loader = new Loader($repo, $cache, $builders);
58
59
        $container->bindInstance(Loader::class, $loader);
60
    }
61
}
62