Plugin::bootstrap()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3.7898

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 5
cts 9
cp 0.5556
rs 9.7666
c 0
b 0
f 0
cc 3
nc 2
nop 1
crap 3.7898
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * This file is part of TwigView.
6
 *
7
 ** (c) 2014 Cees-Jan Kiewiet
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace WyriHaximus\TwigView;
14
15
use Cake\Core\BasePlugin;
16
use Cake\Core\Configure;
17
use Cake\Core\Plugin as CorePlugin;
18
use Cake\Core\PluginApplicationInterface;
19
use Cake\Event\EventManager;
20
21
/**
22
 * Plugin class for WyriHaximus\TwigView.
23
 */
24
class Plugin extends BasePlugin
25
{
26
    /**
27
     * Load all the plugin configuration and bootstrap logic.
28
     *
29
     * @param \Cake\Core\PluginApplicationInterface $app The host application
30
     * @return void
31
     */
32 13
    public function bootstrap(PluginApplicationInterface $app): void
33
    {
34 13
        EventManager::instance()->on(new Event\ExtensionsListener());
35 13
        EventManager::instance()->on(new Event\TokenParsersListener());
36
37 13
        if (Configure::read('debug') && CorePlugin::isLoaded('DebugKit')) {
38
            Configure::write('DebugKit.panels', array_merge(
39
                (array)Configure::read('DebugKit.panels'),
40
                [
41
                    'WyriHaximus/TwigView.Twig',
42
                ]
43
            ));
44
            EventManager::instance()->on(new Event\ProfilerListener());
45
        }
46 13
    }
47
}
48