Completed
Push — master ( 4300f3...6cdd88 )
by Simone
02:19
created

ConstructorResolver   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 17
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 14 2
1
<?php
2
3
namespace Sensorario\Container;
4
5
class ConstructorResolver
6
{
7 5
    public function resolve(Objects\Service $service)
8
    {
9 5
        if ($service->classNotExists()) {
10 1
            throw new \RuntimeException(
11 1
                'Oops! Class ' . $service->getClass() .
12 1
                ' defined as ' . $service->getName() .
13
                ' not found!!!'
14 1
            );
15
        }
16
17 4
        $serviceClass = $service->getClass();
18
19 4
        return new $serviceClass();
20
    }
21
}
22