public static bool Register(NamingContext namingContext, DTypeDesc caller, PhpCallback autoloadFunction, bool throwError, bool prepend) { if (autoloadFunction == null) { PhpException.ArgumentNull("autoloadFunction"); return(false); } if (autoloadFunction.Bind(!throwError, caller, namingContext)) { var context = ScriptContext.CurrentContext; if (FindAutoloadFunction(context, autoloadFunction.ToPhpRepresentation()) != null) { return(false); } if (prepend) { context.SplAutoloadFunctions.AddFirst(autoloadFunction); } else { context.SplAutoloadFunctions.AddLast(autoloadFunction); } return(true); } else { return(false); } }