Module::onBootstrap()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 3
nc 2
nop 1
crap 12
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Fabiang\AsseticBundle;
6
7
use Laminas\EventManager\EventInterface;
8
use Laminas\ModuleManager\Feature\BootstrapListenerInterface;
9
use Laminas\ModuleManager\Feature\ConfigProviderInterface;
10
use Laminas\Mvc\MvcEvent;
11
12
use const PHP_SAPI;
13
14
class Module implements ConfigProviderInterface, BootstrapListenerInterface
15
{
16
    /**
17
     * Listen to the bootstrap event
18
     */
19
    public function onBootstrap(EventInterface $e): void
20
    {
21
        // Only attach the Listener if the request came in through http(s)
22
        if ($e instanceof MvcEvent && PHP_SAPI !== 'cli') {
23
            $app = $e->getApplication();
24
            $app->getServiceManager()->get(Listener::class)->attach($app->getEventManager());
25
        }
26
    }
27
28
    /**
29
     * Returns configuration to merge with application configuration
30
     */
31
    public function getConfig(): iterable
32
    {
33
        return require __DIR__ . '/../config/module.config.php';
34
    }
35
}
36