本文整理汇总了PHP中static::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP static::debug方法的具体用法?PHP static::debug怎么用?PHP static::debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static
的用法示例。
在下文中一共展示了static::debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: instance
public static function instance()
{
if (!self::$instance) {
self::$instance = static::load();
if (!defined('GANTRY5_DEBUG')) {
define('GANTRY5_DEBUG', self::$instance->debug());
}
}
return self::$instance;
}
示例2: setup
/**
* Setup a map of environments to their patterns and optionally debug environments
*
* @param array $map
* @param array $debug [= []]
* @access public
* @return void
* @static
*/
public static function setup(array $map, array $debug = [])
{
array_change_key_case($map, CASE_LOWER);
static::$map = $map;
if (!empty($debug)) {
static::$debug = $debug;
}
}
示例3: isTestsDebug
public static function isTestsDebug()
{
if (null === static::$debug) {
$debug = getenv('SYMFONY_TESTS_DEBUG');
if (false === $debug) {
static::$debug = true;
} else {
static::$debug = filter_var($debug, FILTER_VALIDATE_BOOLEAN);
}
}
return static::$debug;
}
示例4: connect
public static function connect()
{
// config
$params = Config::get('database');
// set debug mode
static::$debug = Config::get('debug', false);
// build dns string
$dsn = 'mysql:dbname=' . $params['name'] . ';host=' . $params['host'];
// try connection
static::$dbh = new PDO($dsn, $params['username'], $params['password']);
// set error handling to exceptions
static::$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return true;
}
示例5: createApplication
/**
* 初始化:创建Application
* @access public
* @param array $config设置
*/
public static function createApplication($config = NULL)
{
if ($config === NULL) {
throw new SYException('Configuration is required', '10001');
} elseif (is_string($config)) {
if (is_file($config)) {
$config = (require $config);
} else {
throw new SYException('Config file ' . $config . ' not exists', '10002');
}
} elseif (!is_array($config)) {
throw new SYException('Config can not be recognised', '10003');
}
//框架所在的绝对路径
static::$frameworkDir = SY_ROOT;
static::$rootDir = rtrim(str_replace('\\', '/', realpath(SY_ROOT . '../')), '/') . '/';
//程序相对网站根目录所在
$now = $_SERVER['PHP_SELF'];
$dir = str_replace('\\', '/', dirname($now));
$dir !== '/' && ($dir = rtrim($dir, '/') . '/');
static::$siteDir = $dir;
//网站根目录
static::$webrootDir = substr(static::$rootDir, 0, strlen(static::$rootDir) - strlen(static::$siteDir)) . '/';
//基本信息
$config['cookie']['path'] = str_replace('@app/', $dir, $config['cookie']['path']);
static::$app = $config;
//应用的绝对路径
static::$appDir = rtrim(str_replace('\\', '/', realpath(SY_ROOT . $config['dir'])), '/') . '/';
if (isset($config['debug'])) {
static::$debug = $config['debug'];
}
mb_internal_encoding($config['charset']);
//是否启用CSRF验证
if ($config['csrf']) {
\sy\lib\YSecurity::csrfSetCookie();
}
//加载App的基本函数
if (is_file(static::$appDir . 'common.php')) {
require static::$appDir . 'common.php';
}
//开始路由分发
static::router();
}
示例6: init
public static function init()
{
static::$debug = ini_get('display_errors') ? true : false;
// stop if there's already an error
if ($error = error_get_last()) {
terror::error($error['message'], $error['type'], $error['file'], $error['line']);
}
/*
// switch off conventional error reporting…
error_reporting(0);
// …to run our own
ini_set('display_errors', 0);
*/
// set a global error handler
set_error_handler(array('Terror', 'errorHandler'));
// track fatal errors
register_shutdown_function(array('Terror', 'shutdownHandler'));
// catch all uncaugth exceptions
set_exception_handler(array('Terror', 'exceptionHandler'));
}
示例7: _init
/**
* Method: _init
* Sets the Errorlevel based on the Configfile
*/
public static function _init()
{
if (Config::getVal('error', 'debug') != 1) {
static::$debug = true;
}
switch (Config::getVal('error', 'level')) {
case 'notice':
static::$error_level = E_NOTICE;
break;
case 'warning':
static::$error_level = E_WARNING & ~E_NOTICE;
break;
case 'error':
static::$error_level = E_ERROR;
break;
case 'all':
static::$error_level = E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_WARNING;
break;
default:
static::$error_level = E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_WARNING;
break;
}
}
示例8: connect
public static function connect()
{
// config
$params = Config::get('database');
// set default mysql port number
if (empty($params['port'])) {
$params['port'] = 3306;
}
// set default collation
if (empty($params['collation'])) {
$params['collation'] = 'utf8_bin';
}
// set debug mode
static::$debug = Config::get('debug', false);
// build dns string
$dsn = 'mysql:dbname=' . $params['name'] . ';host=' . $params['host'] . ';port=' . $params['port'];
// mysql driver options
$options = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\' COLLATE ' . $params['collation']);
// try connection
static::$dbh = new PDO($dsn, $params['username'], $params['password'], $options);
// set error handling to exceptions
static::$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
return true;
}
示例9: setDebug
/**
* Controls whether Annotations are efficiently cached on the file system or not.
*
* @param $debug
*/
public static function setDebug($debug)
{
// Need to recreate the instace.
static::$instance = null;
static::$debug = $debug;
}
示例10: debug
/**
* @param null|bool $bool
* @return bool
*/
public static function debug($bool = null)
{
return is_bool($bool) ? static::$debug = $bool : static::$debug;
}
示例11: __construct
public function __construct()
{
$this->model = $this->getModel();
if (InputHelper::handleInput("debug", false) !== false) {
static::$debug = true;
}
}
示例12: init
public static function init($db, $userID = "", $debug = false)
{
static::$db = $db;
static::$userID = $userID;
static::$debug = $debug;
}
示例13: setDebug
/**
* Sets the debug flag
*
* @static
* @param bool $value
*/
public static function setDebug($value)
{
static::$debug = (bool) $value;
}
示例14: debug
/**
* Debug mode switch
*/
public function debug($switch = true)
{
static::$debug = (bool) $switch;
return $this->trace();
}
示例15: parse
/**
* Parse a MPQ file
*
* @param string $filename
* @param boolean $autoparse
* @param integer $debug
* @return void
*/
public static function parse($filename, $autoparse = true, $debug = 0)
{
$obj = new static();
$obj->filename = $filename;
$obj->debug = $debug;
if (!$obj::$cryptTable) {
$obj::initCryptTable();
}
if (file_exists($obj->filename)) {
$fp = fopen($obj->filename, 'rb');
$contents = fread($fp, filesize($obj->filename));
if ($obj->debug && $contents === false) {
$obj->debug("Error opening file {$filename} for reading");
}
if ($contents !== false) {
$obj->fileData = $contents;
}
fclose($fp);
}
if ($autoparse) {
$obj->parseHeader();
}
return $obj;
}