HoodError.php 750 Bytes
<?php
/**
 * Created by PhpStorm.
 * User: Zip
 * Date: 15/4/27
 * Time: 下午1:35
 */

namespace Hood\Debug;

use Hood\Debug\Debugbar\CollectorInterface;
use Hood\Debug\Debugbar\Handler;

class HoodError
{
    public static $collector = null;

    public static function errorHandler($errno, $errorStr, $errorFile, $errorLine)
    {
        $error = new CollectorInterface\Error();
        $error->message = $errorStr;
        $error->backtrace = array(
            'error_file' => $errorFile,
            'error_line' => $errorLine
        );
        if (self::$collector == null) {
            self::$collector = $handler = new Handler();
        }
        self::$collector->addErrorCollector($error);
        self::$collector->bridge();
    }
}