PropertyInstantiator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 14
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A instantiate() 0 11 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Linio\Component\Input\Instantiator;
6
7
use Doctrine\Common\Inflector\Inflector;
8
9
class PropertyInstantiator implements InstantiatorInterface
10
{
11
    public function instantiate(string $class, array $data)
12
    {
13
        $object = new $class();
14
15
        foreach ($data as $key => $value) {
16
            $property = Inflector::camelize($key);
17
            $object->$property = $value;
18
        }
19
20
        return $object;
21
    }
22
}
23