Created
August 20, 2013 07:51
-
-
Save milo/6278342 to your computer and use it in GitHub Desktop.
Handy Tracy/Nette Debugger in autoprepend file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function __nette($version = NULL) { | |
if ($version) { | |
require "/var/www/lib/nette/$version/Nette/loader.php"; | |
} else { | |
require '/var/www/dev/nette/Nette/loader.php'; | |
} | |
} | |
function __debug($mode = NULL, $logDirectory = NULL, $email = NULL) { | |
if (!class_exists($class = 'Nette\Diagnostics\Debugger') && !class_exists($class = 'Tracy\Debugger')) { | |
require '/var/www/dev/tracy/src/tracy.php'; | |
} | |
$class::enable($mode, $logDirectory, $email); | |
$class::$strictMode = TRUE; | |
if (!class_exists('__DebuggerAdjuster')) { | |
class_alias($class, 'DBG', FALSE); | |
class __DebuggerAdjuster | |
{ | |
private $className; | |
public function __construct($class) | |
{ | |
$this->className = $class; | |
} | |
public function __call($member, array $args) | |
{ | |
$class = $this->className; | |
$class::$$member = array_pop($args); | |
return $this; | |
} | |
} | |
} | |
return new __DebuggerAdjuster($class); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment