-
Notifications
You must be signed in to change notification settings - Fork 15
/
Module.php
47 lines (41 loc) · 1.23 KB
/
Module.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
* Contains the module class used to have encrypt console commands.
*
* @link http://www.creationgears.com/
* @copyright Copyright (c) 2015 Nicola Puddu
* @license http://www.gnu.org/copyleft/gpl.html
* @package nickcv/yii2-encrypter
* @author Nicola Puddu <[email protected]>
*/
namespace nickcv\encrypter;
use yii\base\BootstrapInterface;
/**
* Bootstrap the module to allow the use of the console commands.
*
* @author Nicola Puddu <[email protected]>
* @version 1.1.0
* @property-read \nickcv\encrypter\components\Encrypter $encrypter
*/
class Module extends \yii\base\Module implements BootstrapInterface
{
public function init()
{
$configFile = \Yii::getAlias('@app/config/encrypter.php');
if (file_exists($configFile)) {
$this->setComponents([
'encrypter' => require($configFile),
]);
}
parent::init();
}
public function bootstrap($app)
{
if ($app instanceof \yii\console\Application) {
$this->controllerNamespace = 'nickcv\encrypter\commands';
$this->setAliases([
'@nickcv/encrypter' => dirname(__FILE__),
]);
}
}
}