ResourceModule   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 5
Bugs 0 Features 0
Metric Value
eloc 7
c 5
b 0
f 0
dl 0
loc 19
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A configure() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\Resource\Module;
6
7
use BEAR\Resource\Annotation\AppName;
8
use Override;
9
use Ray\Di\AbstractModule;
10
11
/**
12
 * Provides ResourceInterface and derived bindings
13
 *
14
 * The following module is installed:
15
 *
16
 * AppName
17
 *
18
 * The following module is installed:
19
 *
20
 * ResourceClientModule
21
 * AnnotationModule
22
 * EmbedResourceModule
23
 * HttpClientModule
24
 */
25
final class ResourceModule extends AbstractModule
26
{
27
    /** @param string $appName Application name ex) 'Vendor\Project' */
28
    public function __construct(
29
        private readonly string $appName = '',
30
    ) {
31
        parent::__construct();
32
    }
33
34
    /**
35
     * {@inheritDoc}
36
     */
37
    #[Override]
38
    protected function configure(): void
39
    {
40
        $this->install(new ResourceClientModule());
41
        $this->install(new EmbedResourceModule());
42
        $this->install(new HttpClientModule());
43
        $this->bind()->annotatedWith(AppName::class)->toInstance($this->appName);
44
    }
45
}
46