Passed
Push — feature/initial-implementation ( fae671...591f29 )
by Fike
02:37
created

AbstractOption::getInstance()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
dl 7
loc 7
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
namespace AmaTeam\ElasticSearch\Indexing\Option\Infrastructure;
4
5
use AmaTeam\ElasticSearch\API\Indexing\OptionInterface;
6
7
abstract class AbstractOption implements OptionInterface
8
{
9
    public function allowsNullValue(): bool
10
    {
11
        return false;
12
    }
13
14
    /**
15
     * @var AbstractOption[]
16
     */
17
    protected static $registry = [];
18
19
    /**
20
     * @return static
21
     */
22 View Code Duplication
    public static function getInstance()
0 ignored issues
show
Duplication introduced by
This method 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...
23
    {
24
        $className = get_called_class();
25
        if (!isset(self::$registry[$className])) {
26
            self::$registry[$className] = new static();
27
        }
28
        return self::$registry[$className];
29
    }
30
}
31