CallbackFormDataToObjectConverter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A convertFormDataToObject() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the "elao/form-simple-object-mapper" package.
5
 *
6
 * Copyright (C) Elao
7
 *
8
 * @author Elao <[email protected]>
9
 */
10
11
namespace Elao\FormSimpleObjectMapper\DataMapper;
12
13
/**
14
 * @author Maxime Steinhausser <[email protected]>
15
 */
16
class CallbackFormDataToObjectConverter implements FormDataToObjectConverterInterface
17
{
18
    /**
19
     * The callable used to map form data to an object.
20
     *
21
     * @var callable
22
     */
23
    private $converter;
24
25
    /**
26
     * @param callable $converter
27
     */
28
    public function __construct(callable $converter)
29
    {
30
        $this->converter = $converter;
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function convertFormDataToObject(array $data, $originalData)
37
    {
38
        return call_user_func($this->converter, $data, $originalData);
39
    }
40
}
41