Plugin::console()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 9
ccs 0
cts 5
cp 0
crap 6
rs 10
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
6
 *
7
 * Licensed under The MIT License
8
 * Redistributions of files must retain the above copyright notice.
9
 *
10
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
11
 * @link          http://cakephp.org CakePHP(tm) Project
12
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
13
 */
14
namespace Burzum\CakeServiceLayer;
15
16
use Cake\Console\CommandCollection;
17
use Cake\Core\BasePlugin;
18
19
/**
20
 * Plugin class for Burzum/CakeServiceLayer
21
 */
22
class Plugin extends BasePlugin
23
{
24
    /**
25
     * @var string
26
     */
27
    protected $name = 'Burzum/CakeServiceLayer';
28
29
    /**
30
     * @var bool
31
     */
32
    protected $routesEnabled = false;
33
34
    /**
35
     * @var bool
36
     */
37
    protected $middlewareEnabled = false;
38
39
    /**
40
     * Add migrations commands.
41
     *
42
     * @param \Cake\Console\CommandCollection $collection The command collection to update
43
     * @return \Cake\Console\CommandCollection
44
     */
45
    public function console(CommandCollection $collection): CommandCollection
46
    {
47
        if (class_exists('Bake\Command\SimpleBakeCommand')) {
48
            $commands = $collection->discoverPlugin($this->getName());
49
50
            return $collection->addMany($commands);
51
        }
52
53
        return $collection;
54
    }
55
}
56