Config::define()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1.2441

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 3
cts 8
cp 0.375
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 1
crap 1.2441
1
<?php
2
/**
3
 * Event Provider
4
 *
5
 * PHP version 5
6
 *
7
 * Copyright (C) 2016 Jake Johns
8
 *
9
 * This software may be modified and distributed under the terms
10
 * of the MIT license.  See the LICENSE file for details.
11
 *
12
 * @category  Config
13
 * @package   Fusible\EventProvider
14
 * @author    Jake Johns <[email protected]>
15
 * @copyright 2016 Jake Johns
16
 * @license   http://jnj.mit-license.org/2016 MIT License
17
 * @link      https://github.com/fusible/fusible.event-provider
18
 */
19
20
namespace Fusible\EventProvider;
21
22
use Aura\Di\Container;
23
use Aura\Di\ContainerConfig;
24
25
use Jnjxp\Event;
26
27
/**
28
 * Config
29
 *
30
 * @category Config
31
 * @package  Fusible\EventProvider
32
 * @author   Jake Johns <[email protected]>
33
 * @license  http://jnj.mit-license.org/ MIT License
34
 * @link     https://github.com/fusible/fusible.event-provider
35
 *
36
 * @see ContainerConfig
37
 */
38
class Config extends ContainerConfig
39
{
40
41
    const EMITTER  = 'jnjxp/event:emitter';
42
    const RESOLVER = 'jnjxp/event:resolver';
43
44
    /**
45
     * Define Container
46
     *
47
     * @param Container $di di container
48
     *
49
     * @return null
50
     *
51
     * @access public
52
     *
53
     * @SuppressWarnings(PHPMD.ShortVariable)
54
     */
55 2
    public function define(Container $di)
56
    {
57
        $di->set(static::EMITTER,  $di->lazyNew(Event\Emitter::class));
58
        $di->set(static::RESOLVER, $di->lazyNew(Resolver::class));
59
60
        $di->params[Event\Emitter::class] = [
61 2
            'resolver' => $di->lazyGet(static::RESOLVER),
62
        ];
63
64
        $di->params[Resolver::class] = [
65 2
            'injectionFactory' => $di->getInjectionFactory()
66
        ];
67
    }
68
}
69