Completed
Push — master ( 055691...1f9c21 )
by Siim
13:14
created

DtoPopulator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A populate() 0 8 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: siim
5
 * Date: 24.01.19
6
 * Time: 8:33
7
 */
8
9
namespace Sf4\Api\Dto;
10
11
use Sf4\Populator\Populator;
12
13
class DtoPopulator
14
{
15
    /**
16
     * @param DtoInterface $dto
17
     * @param array $data
18
     */
19
    public function populate(DtoInterface $dto, array $data)
20
    {
21
        $populator = new Populator();
22
        try {
23
            $populator->populate($data, $dto);
24
        } catch (\ReflectionException $e) {
25
            $dto = new ErrorDto();
26
            $dto->error = $e->getMessage();
27
        }
28
    }
29
}
30