AbstractDependencyProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 7
c 0
b 0
f 0
dl 0
loc 30
ccs 0
cts 11
cp 0
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A set() 0 3 1
A provideDependencies() 0 2 1
A get() 0 3 1
A has() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of forecast.it.fill project.
7
 * (c) Patrick Jaja <[email protected]>
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace ForecastAutomation\Kernel;
13
14
use Psr\Container\ContainerInterface;
15
16
class AbstractDependencyProvider implements ContainerInterface
17
{
18
    protected static array $instances;
19
20
    protected Locator $locator;
21
22
    public function __construct()
23
    {
24
        $this->provideDependencies(new Locator($this));
25
    }
26
27
    //ToDo: Pass Container (DI) with module dynamic resolver of KernelConfig Patterns
28
    public function provideDependencies(Locator $locator): void
0 ignored issues
show
Unused Code introduced by
The parameter $locator is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

28
    public function provideDependencies(/** @scrutinizer ignore-unused */ Locator $locator): void

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
29
    {
30
    }
31
32
    public function get(string $id)
33
    {
34
        return static::$instances[$id];
35
    }
36
37
    public function has(string $id): bool
38
    {
39
        // TODO: Implement has() method.
40
        return true;
41
    }
42
43
    public function set(string $id, $concrete): void
44
    {
45
        static::$instances[$id] = $concrete;
46
    }
47
}
48