Completed
Push — master ( 598fe1...4a905b )
by Michael
03:41
created

EventWiring::wire()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 18
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 18
ccs 0
cts 16
cp 0
rs 9.2
cc 4
eloc 10
nc 8
nop 1
crap 20
1
<?php
2
declare(strict_types = 1);
3
/**
4
 * Contains class EventWiring.
5
 *
6
 * PHP version 7.0+
7
 *
8
 * LICENSE:
9
 * This file is part of Yet Another Php Eve Api Library also know as Yapeal
10
 * which can be used to access the Eve Online API data and place it into a
11
 * database.
12
 * Copyright (C) 2016 Michael Cummings
13
 *
14
 * This program is free software: you can redistribute it and/or modify it
15
 * under the terms of the GNU Lesser General Public License as published by the
16
 * Free Software Foundation, either version 3 of the License, or (at your
17
 * option) any later version.
18
 *
19
 * This program is distributed in the hope that it will be useful, but WITHOUT
20
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
22
 * for more details.
23
 *
24
 * You should have received a copy of the GNU Lesser General Public License
25
 * along with this program. If not, see
26
 * <http://spdx.org/licenses/LGPL-3.0.html>.
27
 *
28
 * You should be able to find a copy of this license in the COPYING-LESSER.md
29
 * file. A copy of the GNU GPL should also be available in the COPYING.md file.
30
 *
31
 * @copyright 2016 Michael Cummings
32
 * @license   LGPL-3.0+
33
 * @author    Michael Cummings <[email protected]>
34
 */
35
namespace Yapeal\Configuration;
36
37
use Yapeal\Container\ContainerInterface;
38
39
/**
40
 * Class EventWiring.
41
 */
42
class EventWiring implements WiringInterface
43
{
44
    /**
45
     * @param ContainerInterface $dic
46
     *
47
     * @throws \InvalidArgumentException
48
     */
49
    public function wire(ContainerInterface $dic)
50
    {
51
        if (empty($dic['Yapeal.Event.EveApiEvent'])) {
52
            $dic['Yapeal.Event.EveApi'] = $dic->factory(function ($dic) {
53
                return new $dic['Yapeal.Event.Factories.eveApi']();
54
            });
55
        }
56
        if (empty($dic['Yapeal.Event.LogEvent'])) {
57
            $dic['Yapeal.Event.LogEvent'] = $dic->factory(function ($dic) {
58
                return new $dic['Yapeal.Event.Factories.log'];
59
            });
60
        }
61
        if (empty($dic['Yapeal.Event.Mediator'])) {
62
            $dic['Yapeal.Event.Mediator'] = function ($dic) {
63
                return new $dic['Yapeal.Event.Handlers.mediator']($dic);
64
            };
65
        }
66
    }
67
}
68