Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Handy Tracy/Nette Debugger in autoprepend file
<?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
You can’t perform that action at this time.