ConstructorResolver   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
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 18
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\Resolver;
4
5
use Sensorario\Container\Objects\Service;
6
7
class ConstructorResolver implements
8
    \Sensorario\Container\Resolver\ResolverInterface
9
{
10 6
    public function resolve(Service $service)
11
    {
12 6
        if ($service->classNotExists()) {
13 1
            throw new \RuntimeException(
14 1
                'Oops! Class ' . $service->getClass() .
15 1
                ' defined as ' . $service->getName() .
16 1
                ' not found!!!'
17
            );
18
        }
19
20 5
        $serviceClass = $service->getClass();
21
22 5
        return new $serviceClass();
23
    }
24
}
25