Registry::initInstance()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Bluz Framework Component
5
 *
6
 * @copyright Bluz PHP Team
7
 * @link      https://github.com/bluzphp/framework
8
 */
9
10
declare(strict_types=1);
11
12
namespace Bluz\Proxy;
13
14
use Bluz\Registry\Registry as Instance;
15
16
/**
17
 * Proxy to Registry
18
 *
19
 * Example of usage
20
 * <code>
21
 *     use Bluz\Proxy\Registry;
22
 *
23
 *     Registry::set('key', 'value');
24
 *     Registry::get('key');
25
 * </code>
26
 *
27
 * @package  Bluz\Proxy
28
 * @author   Anton Shevchuk
29
 *
30
 * @method   static Instance getInstance()
31
 *
32
 * @method   static void  set($key, $value)
33
 * @see      Instance::set()
34
 *
35
 * @method   static mixed get($key)
36
 * @see      Instance::get()
37
 *
38
 * @method   static bool  contains($key)
39
 * @see      Instance::contains()
40
 *
41
 * @method   static void  delete($key)
42
 * @see      Instance::delete()
43
 */
44
final class Registry
45
{
46
    use ProxyTrait;
47
48
    /**
49
     * Init instance
50
     *
51
     * @return Instance
52
     */
53 15
    private static function initInstance(): Instance
0 ignored issues
show
Unused Code introduced by
The method initInstance() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
54
    {
55 15
        $instance = new Instance();
56 15
        if ($data = Config::get('registry')) {
57 15
            $instance->setFromArray($data);
58
        }
59 15
        return $instance;
60
    }
61
}
62