Module   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
eloc 5
dl 0
loc 20
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getConfig() 0 3 1
A onBootstrap() 0 6 3
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