TipologiaCampo::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace BitPrepared\Bundle\FormazioneBundle\Domain\ValueObject;
4
5
/**
6
 * Tipologia di campo CFM/CFT/CCG/CAM
7
 */
8 View Code Duplication
abstract class TipologiaCampo
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
{
10
    /**
11
     * nome esplicativo della enum
12
     *
13
     * @var string
14
     */
15
    protected $name;
16
17
    /**
18
     * Singleton instance for enum
19
     *
20
     * @var BitPrepared\Bundle\FormazioneBundle\Domain\ValueObject\TipologiaCampo
21
     */
22
    protected static $instance;
23
24
    /**
25
     * @return string
26
     */
27
    final public function getName()
28
    {
29
        return $this->name;
30
    }
31
32
    /**
33
     * @return BitPrepared\Bundle\FormazioneBundle\Domain\ValueObject\TipologiaCampo|null
34
     */
35
    final public static function parseString($parseString)
36
    {
37
        $className = 'BitPrepared\Bundle\FormazioneBundle\Domain\ValueObject\TipologiaCampo'.'\\'.$parseString;
38
        if (class_exists($className)) {
39
            $enumClass = $className::instance();
40
41
            return $enumClass;
42
        }
43
    }
44
}
45