Passed
Push — master ( 7ef222...7c8367 )
by Tom
01:44
created

Dependencies::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 12
nc 1
nop 0
dl 0
loc 24
ccs 8
cts 8
cp 1
crap 1
rs 9.8666
c 0
b 0
f 0
1
<?php
2
3
namespace NoaaCapAlerts;
4
5
use NoaaCapAlerts\Model\NoaaAlertManager;
6
use NoaaCapAlerts\Parser\IndexParser;
7
use NoaaCapAlerts\Parser\XmlParser;
8
use NoaaCapAlerts\XmlProvider\XmlProviderFactory;
9
use Pimple\Container;
10
11
class Dependencies extends Container
12
{
13
    protected $container;
14
15 1
    function __construct()
16
    {
17 1
        parent::__construct();
18
19 1
        $this['LocalFile'] = getenv("NoaaLocalFilePath");
20
21
        $this['NoaaAlertManager'] = function ($c) {
22 1
            return new NoaaAlertManager($c['XmlProvider'], $c['IndexParser']);
23
        };
24
25
        $this['XmlProvider'] = function ($c) {
26 1
            return $c['XmlProviderFactory']->getXmlProvider();
27
        };
28
29
        $this['XmlProviderFactory'] = function ($c) {
30 1
            return new XmlProviderFactory($c['LocalFile']);
31
        };
32
33
        $this['IndexParser'] = function ($c) {
34 1
            return new IndexParser($c['XmlParser']);
35
        };
36
37
        $this['XmlParser'] = function ($c) {
0 ignored issues
show
Unused Code introduced by
The parameter $c 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

37
        $this['XmlParser'] = function (/** @scrutinizer ignore-unused */ $c) {

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...
38 1
            return new XmlParser();
39
        };
40 1
    }
41
}
42
43
44