LazyModule   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 6 1
A __construct() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\Package;
6
7
use BEAR\AppMeta\AbstractAppMeta;
8
use BEAR\Package\Module\ResourceObjectModule;
9
use BEAR\Package\Module\ScriptInjectorModule;
10
use Ray\Compiler\LazyModuleInterface;
11
use Ray\Di\AbstractModule;
12
13
class LazyModule implements LazyModuleInterface
14
{
15
    public function __construct(
16
        private AbstractAppMeta $appMeta,
17
        private string $context,
18
        private string $scriptDir,
19
    ) {
20
    }
21
22
    public function __invoke(): AbstractModule
23
    {
24
        $module = new ScriptInjectorModule($this->scriptDir, (new Module())($this->appMeta, $this->context));
25
        $module->install(new ResourceObjectModule($this->appMeta->getResourceListGenerator()));
26
27
        return $module;
28
    }
29
}
30