Dependencies::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

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

33
        $this['PolygonFactory'] = 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...
34
            return new PolygonFactory();
35 1
        };
36
37
        $this['IndexParser'] = function ($c) {
38
            return new NoaaIndexParser($c['XmlParser']);
39 1
        };
40
41
        $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

41
        $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...
42
            return new XmlParser();
43 1
        };
44
    }
45 1
}
46
47
48