AbstractTranslatableCustomOption   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 38
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getLabel() 0 6 4
A setLabel() 0 6 1
A getSortOrderColumn() 0 4 1
A getLabelProperty() 0 4 1
1
<?php
2
3
namespace Pim\Bundle\CustomEntityBundle\Entity;
4
5
/**
6
 * @author    Antoine Guigan <[email protected]>
7
 * @copyright 2013 Akeneo SAS (http://www.akeneo.com)
8
 * @license   http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
9
 *
10
 * @deprecated will be removed in 1.7,
11
 *             please use \Pim\Bundle\CustomEntityBundle\Entity\AbstractTranslatableCustomEntity
12
 */
13
abstract class AbstractTranslatableCustomOption extends AbstractTranslatableCustomEntity
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function getLabel()
19
    {
20
        $translated = $this->getTranslation() ? $this->getTranslation()->getLabel() : null;
21
22
        return ($translated !== '' && $translated !== null) ? $translated : '['.$this->getCode().']';
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function setLabel($label)
29
    {
30
        $this->getTranslation()->setLabel($label);
31
32
        return $this;
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public static function getSortOrderColumn()
39
    {
40
        return 'label';
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public static function getLabelProperty()
47
    {
48
        return 'label';
49
    }
50
}
51