Passed
Push — dev ( 40f0b5...3a2e98 )
by Fike
02:50
created

AbstractParameter::getFriendlyId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AmaTeam\ElasticSearch\Mapping\Type\Parameter\Infrastructure;
6
7
use AmaTeam\ElasticSearch\API\Mapping\Type\ParameterInterface;
8
9
/**
10
 * @SuppressWarnings(PHPMD.NumberOfChildren)
11
 */
12
abstract class AbstractParameter implements ParameterInterface
13
{
14
    /**
15
     * @var AbstractParameter[]
16
     */
17
    protected static $registry = [];
18
19
    public function getFriendlyId(): string
20
    {
21
        return $this->getId();
22
    }
23
24
    /**
25
     * @inheritDoc
26
     */
27
    public function nullValueAllowed(): bool
28
    {
29
        return false;
30
    }
31
32 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...
33
    {
34
        $className = get_called_class();
35
        if (!isset(static::$registry[$className])) {
36
            static::$registry[$className] = new static();
37
        }
38
        return static::$registry[$className];
39
    }
40
}
41