NormalizerProcessor   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getConfigurationFields() 0 4 1
A process() 0 4 1
1
<?php
2
3
namespace Pim\Bundle\ExcelConnectorBundle\Processor;
4
5
use Akeneo\Component\Batch\Item\AbstractConfigurableStepElement;
6
use Akeneo\Component\Batch\Item\ItemProcessorInterface;
7
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
8
9
/**
10
 * Processor encoding the data for a specific format
11
 *
12
 * @author    Antoine Guigan <[email protected]>
13
 * @copyright 2013 Akeneo SAS (http://www.akeneo.com)
14
 * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
15
 */
16
class NormalizerProcessor extends AbstractConfigurableStepElement implements ItemProcessorInterface
17
{
18
    /** @var NormalizerInterface */
19
    protected $normalizer;
20
21
    /** @var string */
22
    protected $format;
23
24
    /** @var array */
25
    protected $context;
26
27
    /**
28
     * @param NormalizerInterface $normalizer
29
     * @param string              $format
30
     * @param array               $context
31
     */
32
    public function __construct(NormalizerInterface $normalizer, $format, array $context = array())
33
    {
34
        $this->normalizer = $normalizer;
35
        $this->format = $format;
36
        $this->context = $context;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function getConfigurationFields()
43
    {
44
        return array();
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function process($item)
51
    {
52
        return $this->normalizer->normalize($item, $this->format, $this->context);
53
    }
54
}
55