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