-
Notifications
You must be signed in to change notification settings - Fork 0
/
Environment.php
85 lines (75 loc) · 1.6 KB
/
Environment.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/**
* Environment
*
* @version 1.0.0
* @copyright Copyright 2011 by Kirya <[email protected]>
* @author Kirya <[email protected]>
*/
class Environment implements EnvironmentInterface
{
/**
* params
*
* @var array
*/
private $_params;
/**
* debug
*
* @var boolean
*/
private $_debug = false;
/**
* __construct
*
* @param array $params
* @return void
*/
public function __construct($params)
{
$this->_params = $params;
if (isset($this->_params['params']['debug'])) {
$this->_debug = $this->_params['params']['debug'];
}
}
/**
* loadYii
*
* @return void
*/
public function loadYii()
{
//load Yii
$frameworkPath = ROOT_PATH . '/vendor/yii/yii';
if ($this->_debug) {
// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG', true);
// specify how many levels of call stack
// should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3);
$yii = $frameworkPath . '/yii.php';
} else {
$yii = $frameworkPath . '/yiilite.php';
}
require_once($yii);
}
/**
* getDebug
*
* @return void
*/
public function getDebug()
{
return $this->_debug;
}
/**
* getParams
*
* @return void
*/
public function getParams()
{
return $this->_params;
}
}