<?php

namespace Shared;

class Debug
{
    public static $DebugEnabled=true;

    private $active=false;

    public static $Instance;

    public function __construct()
        {
            $this->Activate();
        }

    public static function Instance()
    {
        return self::$Instance;
    }

    public function IsActive()
    {
        return $this->active;
    }

    public function Deactivate()
    {
        $this->active=false;
        return $this;
    }
    public function Activate()
    {
        $this->active= self::$DebugEnabled;
        return $this;
    }

    public function Display($title,$var)
    {
        if(!$this->active) return $this;     
        highlight_string("<?php\n".$title."\n" . @var_export($var, true) . ";\n?>"); 
        echo "<pre>";
        debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
        echo "</pre>"; 
        return $this;
    }
}

Debug::$Instance = new Debug();
Debug::$Instance->Deactivate();
