Completed
Push — develop ( f102ca...488b09 )
by Mathias
20:12 queued 11:00
created

Module::getConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * YAWIK
4
 * Auth Module Bootstrap
5
 *
6
 * @copyright (c) 2013 - 2016 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
use Yawik\Composer\RequireDirectoryPermissionInterface;
17
use Core\Options\ModuleOptions as CoreOptions;
18
19
/**
20
 * Bootstrap class of the Core module
21
 */
22
class Module implements ConsoleUsageProviderInterface, RequireDirectoryPermissionInterface
23
{
24
25
    public function getRequiredDirectoryLists(CoreOptions $options)
26
    {
27
        return [
28
            $options->getPublicDir().'/static/Jobs',
29
            $options->getPublicDir().'/static/Jobs/logos',
30
        ];
31
    }
32
33
    public function getConsoleUsage(Console $console)
34
    {
35
        return [
36
            'Expire jobs',
37
            'jobs expire [--days] [--limit] [--info]'  => 'Expire jobs',
38
            ['--days=INT', 'expire jobs after <days> days. Default 30'],
39
            ['--limit=INT[,<offset>]', 'Limit jobs to expire per run starting from <offset>. Default 10. 0 means no limit'],
40
            ['--info', 'Does not manipulate the database, but prints a list of all matched jobs.']
41
        ];
42
    }
43
44
    /**
45
     * Loads module specific configuration.
46
     *
47
     * @return array
48
     */
49 5
    public function getConfig()
50
    {
51 5
        return ModuleConfigLoader::load(__DIR__ . '/../config');
52
    }
53
54 4
    public function onBootstrap(MvcEvent $e)
55
    {
56 4
        $eventManager = $e->getApplication()->getEventManager();
57 4
        $services     = $e->getApplication()->getServiceManager();
58 4
        $sharedManager = $eventManager->getSharedManager();
59
60 4
        $defaultlistener = $services->get('Jobs/Listener/Publisher');
61 4
        $defaultlistener->attachShared($sharedManager);
62 4
    }
63
}
64