Completed
Pull Request — master (#19)
by Alberto
03:45
created

Plugin   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 34
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A bootstrap() 0 7 1
A console() 0 7 1
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * BEdita, API-first content management framework
6
 * Copyright 2020 ChannelWeb Srl, Chialab Srl
7
 *
8
 * This file is part of BEdita: you can redistribute it and/or modify
9
 * it under the terms of the GNU Lesser General Public License as published
10
 * by the Free Software Foundation, either version 3 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * See LICENSE.LGPL or <http://gnu.org/licenses/lgpl-3.0.html> for more details.
14
 */
15
namespace BEdita\WebTools;
16
17
use BEdita\WebTools\Command\CacheClearallCommand;
18
use Cake\Console\CommandCollection;
19
use Cake\Core\BasePlugin;
20
use Cake\Core\PluginApplicationInterface;
21
22
/**
23
 * Plugin class for BEdita\WebTools.
24
 */
25
class Plugin extends BasePlugin
26
{
27
    /**
28
     * Load routes or not
29
     *
30
     * @var bool
31
     */
32
    protected $routesEnabled = false;
33
34
    /**
35
     * Use `cache clear_all` from BEdita\WebTools\Command\CacheClearallCommand
36
     *
37
     * @param \Cake\Console\CommandCollection $commands Console commands.
38
     * @return \Cake\Console\CommandCollection
39
     */
40
    public function console(CommandCollection $commands): CommandCollection
41
    {
42
        parent::console($commands);
43
        $commands->remove('cache clear_all');
44
        $commands->add('cache clear_all', CacheClearallCommand::class);
45
46
        return $commands;
47
    }
48
49
    /**
50
     * {@inheritDoc}
51
     */
52
    public function bootstrap(PluginApplicationInterface $app): void
53
    {
54
        // Call parent to load bootstrap from files.
55
        parent::bootstrap($app);
56
57
        // Load more plugins here
58
        $app->addPlugin('Cake/TwigView');
59
    }
60
}
61