public static void addThreadSupport(Thread thread, final Environment env) {
        thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(Thread t, Throwable e) {
                Environment.catchThrowable(e, env);
            }
        });
    }
Gets Environment for current thread context
jphp-runtime/src/php/runtime/env/Environment.java