AppMetaModule   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 21
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A configure() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\Package\Module;
6
7
use BEAR\AppMeta\AbstractAppMeta;
8
use BEAR\Resource\Annotation\AppName;
9
use BEAR\Sunday\Extension\Application\AppInterface;
10
use Ray\Di\AbstractModule;
11
use Ray\Di\Scope;
12
13
class AppMetaModule extends AbstractModule
14
{
15
    /** @var AbstractAppMeta */
16
    private $appMeta;
17
18
    public function __construct(AbstractAppMeta $appMeta, ?AbstractModule $module = null)
19
    {
20
        $this->appMeta = $appMeta;
21
        parent::__construct($module);
22
    }
23
24
    /**
25
     * {@inheritdoc}
26
     */
27
    protected function configure(): void
28
    {
29
        $this->bind(AbstractAppMeta::class)->toInstance($this->appMeta);
30
        $this->bind(AppInterface::class)->to($this->appMeta->name . '\Module\App')->in(Scope::SINGLETON);
31
        $this->bind()->annotatedWith(AppName::class)->toInstance($this->appMeta->name);
32
    }
33
}
34