Plugin::onPluginsLoaded()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 8
ccs 6
cts 6
cp 1
crap 1
rs 10
1
<?php
2
/**
3
 * Plugin class
4
 */
5
namespace Phile\Plugin\Phile\TemplateTwig;
6
7
use Phile\Core\Container;
8
use Phile\Core\ServiceLocator;
9
use Phile\Plugin\AbstractPlugin;
10
use Phile\Plugin\Phile\TemplateTwig\Template\Twig;
11
12
/**
13
 * Class Plugin
14
 * Default Phile template engine
15
 *
16
 * @author  PhileCMS
17
 * @link    https://philecms.github.io
18
 * @license http://opensource.org/licenses/MIT
19
 * @package Phile\Plugin\Phile\TemplateTwig
20
 */
21
class Plugin extends AbstractPlugin
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    protected $events = ['plugins_loaded' => 'onPluginsLoaded'];
27
28
    /**
29
     * Registers Twig as template service
30
     *
31
     * @param array $data
32
     * @return void
33
     */
34 34
    public function onPluginsLoaded($data)
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

34
    public function onPluginsLoaded(/** @scrutinizer ignore-unused */ $data)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
35
    {
36 34
        $phile = Container::getInstance()->get('Phile_Config');
37 34
        $settings = $this->settings + [
38 34
            'theme' => $phile->get('theme'),
39 34
            'themes_dir' => $phile->get('themes_dir')
40
        ];
41 34
        ServiceLocator::registerService('Phile_Template', new Twig($settings));
42
    }
43
}
44