1
|
|
|
<?php namespace Comodojo\Dispatcher\Events; |
2
|
|
|
|
3
|
|
|
use \Comodojo\Dispatcher\Traits\ConfigurationTrait; |
4
|
|
|
use \Comodojo\Dispatcher\Traits\LoggerTrait; |
5
|
|
|
use \Comodojo\Dispatcher\Traits\CacheTrait; |
6
|
|
|
use \Comodojo\Dispatcher\Traits\EventsTrait; |
7
|
|
|
use \Comodojo\Dispatcher\Traits\RequestTrait; |
8
|
|
|
use \Comodojo\Dispatcher\Traits\ResponseTrait; |
9
|
|
|
use \Comodojo\Dispatcher\Traits\RouterTrait; |
10
|
|
|
use \Comodojo\Dispatcher\Traits\ExtraTrait; |
11
|
|
|
use \Comodojo\Dispatcher\Request\Model as Request; |
12
|
|
|
use \Comodojo\Dispatcher\Router\Model as Router; |
13
|
|
|
use \Comodojo\Dispatcher\Response\Model as Response; |
14
|
|
|
use \Comodojo\Dispatcher\Extra\Model as Extra; |
15
|
|
|
use \Comodojo\Foundation\Events\AbstractEvent; |
16
|
|
|
use \Comodojo\SimpleCache\Manager as CacheManager; |
17
|
|
|
use \Comodojo\Foundation\Events\Manager as EventsManager; |
18
|
|
|
use \Comodojo\Foundation\Base\Configuration; |
19
|
|
|
use \Psr\Log\LoggerInterface; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @package Comodojo Dispatcher |
23
|
|
|
* @author Marco Giovinazzi <[email protected]> |
24
|
|
|
* @author Marco Castiello <[email protected]> |
25
|
|
|
* @license GPL-3.0+ |
26
|
|
|
* |
27
|
|
|
* LICENSE: |
28
|
|
|
* |
29
|
|
|
* This program is free software: you can redistribute it and/or modify |
30
|
|
|
* it under the terms of the GNU Affero General Public License as |
31
|
|
|
* published by the Free Software Foundation, either version 3 of the |
32
|
|
|
* License, or (at your option) any later version. |
33
|
|
|
* |
34
|
|
|
* This program is distributed in the hope that it will be useful, |
35
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
36
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
37
|
|
|
* GNU Affero General Public License for more details. |
38
|
|
|
* |
39
|
|
|
* You should have received a copy of the GNU Affero General Public License |
40
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
41
|
|
|
*/ |
42
|
|
|
|
43
|
|
|
class ServiceEvent extends AbstractEvent { |
44
|
|
|
|
45
|
|
|
use ConfigurationTrait; |
46
|
|
|
use LoggerTrait; |
47
|
|
|
use CacheTrait; |
48
|
|
|
use EventsTrait; |
49
|
|
|
use RequestTrait; |
50
|
|
|
use RouterTrait; |
51
|
|
|
use ResponseTrait; |
52
|
|
|
use ExtraTrait; |
53
|
|
|
|
54
|
|
View Code Duplication |
public function __construct( |
|
|
|
|
55
|
|
|
$name, |
56
|
|
|
Configuration $configuration, |
57
|
|
|
LoggerInterface $logger, |
58
|
|
|
CacheManager $cache, |
59
|
|
|
EventsManager $events, |
60
|
|
|
Request $request, |
61
|
|
|
Router $router, |
62
|
|
|
Response $response, |
63
|
|
|
Extra $extra |
64
|
|
|
) { |
65
|
|
|
|
66
|
|
|
parent::__construct($name); |
67
|
|
|
|
68
|
|
|
$this->setConfiguration($configuration); |
69
|
|
|
$this->setLogger($logger); |
70
|
|
|
$this->setCache($cache); |
71
|
|
|
$this->setEvents($events); |
72
|
|
|
$this->setRequest($request); |
73
|
|
|
$this->setRouter($router); |
74
|
|
|
$this->setResponse($response); |
75
|
|
|
$this->setExtra($extra); |
76
|
|
|
|
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
} |
80
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.