SmartObjectRegister   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 31
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 6 2
A getRegister() 0 4 1
1
<?php
2
3
/**
4
 * Register for Smart Objects.
5
 */
6
declare(strict_types = 1);
7
8
namespace HDNET\Autoloader;
9
10
/**
11
 * Register for Smart Objects.
12
 */
13
class SmartObjectRegister
14
{
15
    /**
16
     * Register for smart object information.
17
     *
18
     * @var array
19
     */
20
    protected static $smartObjectRegistry = [];
21
22
    /**
23
     * Add a model to the register.
24
     *
25
     * @param $modelName
26
     */
27
    public static function register($modelName): void
28
    {
29
        if (!\in_array($modelName, self::$smartObjectRegistry, true)) {
30
            self::$smartObjectRegistry[] = $modelName;
31
        }
32
    }
33
34
    /**
35
     * Get the register content.
36
     *
37
     * @return array
38
     */
39
    public static function getRegister()
40
    {
41
        return self::$smartObjectRegistry;
42
    }
43
}
44