ConversionUnitsTransformer   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A setValue() 0 8 1
1
<?php
2
3
namespace Pim\Bundle\ExcelConnectorBundle\Transformer\Property;
4
5
use Pim\Bundle\TransformBundle\Transformer\ColumnInfo\ColumnInfoInterface;
6
use Pim\Bundle\TransformBundle\Transformer\Property\DefaultTransformer;
7
use Pim\Bundle\TransformBundle\Transformer\Property\EntityUpdaterInterface;
8
9
/**
10
 * Conversion units transformer
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 ConversionUnitsTransformer extends DefaultTransformer implements EntityUpdaterInterface
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function setValue($object, ColumnInfoInterface $columnInfo, $data, array $options = array())
22
    {
23
        $suffixes = $columnInfo->getSuffixes();
24
        $member = array_pop($suffixes);
25
        $value = $object->getConversionUnits();
26
        $value[$member] = $data;
27
        $object->setConversionUnits($value);
28
    }
29
}
30