-
Notifications
You must be signed in to change notification settings - Fork 988
/
globals.php
38 lines (36 loc) · 1.27 KB
/
globals.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
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
/**
* This file contains global helper function used in LS.
* This file MUST NOT depend on any other files, except those available in Yii
* by default.
*
*/
/**
* Helper function to replace calls to Yii::app() and enable correct code completion.
* @return LSYii_Application
*/
function App()
{
/** @var LSYii_Application $app */
$app = Yii::app();
return $app;
}
/**
* If debug = 2 in application/config.php this will produce output in the console / firebug
* similar to var_dump. It will also include the filename and line that called this method.
*
* @param mixed $variable The variable to be dumped
* @param int $depth Maximum depth to go into the variable, default is 10
*/
function traceVar($variable, $depth = 10)
{
$msg = CVarDumper::dumpAsString($variable, $depth, false);
$fullTrace = debug_backtrace();
$trace = array_shift($fullTrace);
if (isset($trace['file'], $trace['line']) && strpos($trace['file'], YII_PATH) !== 0) {
$msg = $trace['file'].' ('.$trace['line']."):\n".$msg;
}
Yii::log($msg, 'trace', 'vardump');
}