|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* YAWIK |
|
4
|
|
|
* Auth Module Bootstrap |
|
5
|
|
|
* |
|
6
|
|
|
* @copyright (c) 2013-2015 Cross Solution (http://cross-solution.de) |
|
7
|
|
|
* @license MIT |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
namespace Jobs; |
|
11
|
|
|
|
|
12
|
|
|
use Zend\Mvc\MvcEvent; |
|
13
|
|
|
use Zend\Console\Adapter\AdapterInterface as Console; |
|
14
|
|
|
use Zend\ModuleManager\Feature\ConsoleUsageProviderInterface; |
|
15
|
|
|
use Core\ModuleManager\ModuleConfigLoader; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Bootstrap class of the Core module |
|
19
|
|
|
*/ |
|
20
|
|
|
class Module implements ConsoleUsageProviderInterface |
|
21
|
|
|
{ |
|
22
|
|
|
|
|
23
|
|
|
public function getConsoleUsage(Console $console) |
|
24
|
|
|
{ |
|
25
|
|
|
return array( |
|
26
|
|
|
'Manipulation of jobs database', |
|
27
|
|
|
'jobs generatekeywords [--filter=]' => '(Re-)Generates keywords for all jobs.', |
|
28
|
|
|
array('--filter=JSON', "available keys:\n" |
|
29
|
|
|
. "- 'before:ISODate' -> only jobs before the given date\n" |
|
30
|
|
|
. "- 'after':ISODate' -> only jobs after the given date\n" |
|
31
|
|
|
. "- 'title':String -> exakt title to match or if starting with '/' -> MongoRegex\n" |
|
32
|
|
|
. "- 'limit':INT -> Limit result."), |
|
33
|
|
|
); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Loads module specific configuration. |
|
38
|
|
|
* |
|
39
|
|
|
* @return array |
|
40
|
|
|
*/ |
|
41
|
|
|
public function getConfig() |
|
42
|
|
|
{ |
|
43
|
|
|
return ModuleConfigLoader::load(__DIR__ . '/config'); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Loads module specific autoloader configuration. |
|
48
|
|
|
* |
|
49
|
|
|
* @return array |
|
50
|
|
|
*/ |
|
51
|
|
View Code Duplication |
public function getAutoloaderConfig() |
|
|
|
|
|
|
52
|
|
|
{ |
|
53
|
|
|
return array( |
|
54
|
|
|
'Zend\Loader\StandardAutoloader' => array( |
|
55
|
|
|
'namespaces' => array( |
|
56
|
|
|
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, |
|
57
|
|
|
__NAMESPACE__ . 'Test' => __DIR__ . '/test/' . __NAMESPACE__ . 'Test', |
|
58
|
|
|
), |
|
59
|
|
|
), |
|
60
|
|
|
); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
View Code Duplication |
public function onBootstrap(MvcEvent $e) |
|
|
|
|
|
|
64
|
|
|
{ |
|
65
|
|
|
$eventManager = $e->getApplication()->getEventManager(); |
|
66
|
|
|
$services = $e->getApplication()->getServiceManager(); |
|
67
|
|
|
$sharedManager = $eventManager->getSharedManager(); |
|
68
|
|
|
|
|
69
|
|
|
$defaultlistener = $services->get('Jobs/Listener/Publisher'); |
|
70
|
|
|
$defaultlistener->attachShared($sharedManager); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|
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.