EnumTest::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace TestNamespace;
4
5
/**
6
 * Generated Class
7
 */
8 View Code Duplication
abstract class EnumTest
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 TestNamespace\EnumTest
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 TestNamespace\EnumTest|null
34
     */
35
    final public static function parseString($parseString)
36
    {
37
        $className = 'TestNamespace\EnumTest'.'\\'.$parseString;
38
        if (class_exists($className)) {
39
            $enumClass = $className::instance();
40
41
            return $enumClass;
42
        }
43
    }
44
}
45