convertFormDataToObject()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
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