Passed
Pull Request — 1.x (#275)
by Naoki
15:07
created

ResourceObjectModule   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A configure() 0 4 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\Resource\Module;
6
7
use BEAR\Resource\ResourceObject;
8
use Ray\Di\AbstractModule;
9
10
/**
11
 * Bind resource object for compile
12
 */
13
class ResourceObjectModule extends AbstractModule
14
{
15
    /** @param iterable<class-string<ResourceObject>> $resourceObjects */
16
    public function __construct(
17
        private iterable $resourceObjects,
18
    ) {
19
        parent::__construct();
20
    }
21
22
    protected function configure(): void
23
    {
24
        foreach ($this->resourceObjects as $ro) {
25
            $this->bind($ro);
26
        }
27
    }
28
}
29