Test Setup Failed
Push — develop ( 175c43...8626a8 )
by Carsten
05:34
created

PimpleServiceProvider::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Germania\Worlds;
3
4
use Pimple\Container;
0 ignored issues
show
Bug introduced by
The type Pimple\Container was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
5
use Pimple\ServiceProviderInterface;
0 ignored issues
show
Bug introduced by
The type Pimple\ServiceProviderInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
7
8
class PimpleServiceProvider implements ServiceProviderInterface
9
{
10
11
    /**
12
     * @var array
13
     */
14
    public $config = [
15
            'pdo' => null,
16
            'worlds_table' => null
17
        ];
18
19
20
    /**
21
     * @param array|null $config Service Configuration
22
     */
23
    public function __construct( array $config = array() )
24
    {
25
        $this->config = array_merge($this->config, $config );
26
    }
27
28
29
    /**
30
     * @implements ServiceProviderInterface
31
     */
32
    public function register(Container $dic)
33
    {
34
35
        /**
36
         * @return array
37
         */
38
        $dic['Worlds.Config'] = function( $dic ) {
0 ignored issues
show
Unused Code introduced by
The parameter $dic 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

38
        $dic['Worlds.Config'] = function( /** @scrutinizer ignore-unused */ $dic ) {

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...
39
            return $this->config;
40
        };
41
42
        /**
43
         * @return PDO
44
         */
45
        $dic['Worlds.PDO'] = function( $dic ) {
0 ignored issues
show
Unused Code introduced by
The parameter $dic 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

45
        $dic['Worlds.PDO'] = function( /** @scrutinizer ignore-unused */ $dic ) {

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...
46
            return null;
47
        };
48
49
50
        /**
51
         * @return PdoWorlds
52
         */
53
        $dic['Worlds.All'] = function( $dic ) {
54
            $worlds_config = $dic['Worlds.Config'];
55
            $worlds_table  = $worlds_config['worlds_table'];
56
57
            $pdo           = $dic['Worlds.PDO' ];
58
            return new PdoWorlds( $pdo, null, $worlds_table );
59
        };
60
61
62
63
    }
64
}
65