Completed
Push — master ( d5dcc5...a58d14 )
by Johannes Skov
10s
created

ConfigServiceProvider::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
/**
3
 * VisualPHPUnit
4
 *
5
 * VisualPHPUnit is a visual front-end for PHPUnit.
6
 *
7
 * PHP Version 5.6<
8
 *
9
 * @author    Johannes Skov Frandsen <[email protected]>
10
 * @copyright 2011-2016 VisualPHPUnit
11
 * @license   http://opensource.org/licenses/BSD-3-Clause The BSD License
12
 * @link      https://github.com/VisualPHPUnit/VisualPHPUnit VisualPHPUnit
13
 */
14
namespace Visualphpunit\Provider;
15
16
use Pimple\Container;
17
use Silex\Application;
18
use Pimple\ServiceProviderInterface;
19
use Silex\Api\BootableProviderInterface;
20
21
/**
22
 * Visualphpunit Silex Config provider
23
 *
24
 * @author Johannes Skov Frandsen <[email protected]>
25
 */
26
class ConfigServiceProvider implements ServiceProviderInterface, BootableProviderInterface
27
{
28
29
    /**
30
     * Path to config file
31
     *
32
     * @var string
33
     */
34
    private $path;
35
36
    /**
37
     * Specify the path to the config file
38
     *
39
     * @param string $path
40
     */
41
    public function __construct($path)
42
    {
43
        $this->path = $path;
44
    }
45
46
    /**
47
     * Register the provider
48
     *
49
     * @param Application $app
0 ignored issues
show
Documentation introduced by
Should the type for parameter $app not be Container?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
50
     * @return \Carpet\Provider\Jira
0 ignored issues
show
Documentation introduced by
Should the return type not be \Carpet\Provider\Jira|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
51
     */
52
    public function register(Container $app)
53
    {
54
        $app["config"] = json_decode(file_get_contents($this->path), true)['config'];
55
    }
56
57
    /**
58
     * Boot the provider
59
     *
60
     * @param Application $app
61
     */
62
    public function boot(Application $app)
63
    {
64
    }
65
}
66