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