Bootstrap   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 19
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A bootstrap() 0 10 4
1
<?php
2
/**
3
 * @link https://github.com/vuongxuongminh/yii2-searchable
4
 * @copyright Copyright (c) 2019 Vuong Xuong Minh
5
 * @license [New BSD License](http://www.opensource.org/licenses/bsd-license.php)
6
 */
7
8
namespace vxm\searchable;
9
10
use yii\base\BootstrapInterface;
11
use yii\console\Application as ConsoleApp;
12
13
use vxm\searchable\console\CommandController;
14
15
/**
16
 * Class Bootstrap boot searchable component and console searchable controller.
17
 *
18
 * @author Vuong Minh <[email protected]>
19
 * @since 1.0.0
20
 */
21
class Bootstrap implements BootstrapInterface
22
{
23
24
    /**
25
     * @inheritDoc
26
     * @throws \yii\base\InvalidConfigException
27
     */
28 13
    public function bootstrap($app)
29
    {
30 13
        if (!$app->get('searchable', false)) {
31 13
            $app->set('searchable', ['class' => Searchable::class]);
32
        }
33
34 13
        if ($app instanceof ConsoleApp && !isset($app->controllerMap['searchable'])) {
35 13
            $app->controllerMap['searchable'] = CommandController::class;
36
        }
37 13
    }
38
39
}
40