/// <summary>Enables and configures PHP .NET support in the <see cref="MirrorSharpOptions" />.</summary> /// <param name="options">Options to configure</param> /// <param name="setup">Setup delegate used to configure <see cref="MirrorSharpPhpOptions" /></param> /// <returns>Value of <paramref name="options" />, for convenience.</returns> public static MirrorSharpOptions EnablePhp(this MirrorSharpOptions options, Action <MirrorSharpPhpOptions>?setup = null) { Argument.NotNull(nameof(options), options); options.Languages.Add(PhpLanguage.Name, () => { var phpOptions = new MirrorSharpPhpOptions(); setup?.Invoke(phpOptions); return(new PhpLanguage(phpOptions)); }); return(options); }
public PhpSession(string text, MirrorSharpPhpOptions options) { _text = text; _options = options; var syntaxTree = PhpSyntaxTree.ParseCode(text, PhpParseOptions.Default, PhpParseOptions.Default, ScriptFileName); Compilation = (PhpCompilation)CoreCompilation.AddSyntaxTrees(syntaxTree); if (options.Debug == false) { Compilation = Compilation.WithPhpOptions(Compilation.Options.WithOptimizationLevel(PeachpieRoslyn.OptimizationLevel.Release)); } }
public PhpLanguage(MirrorSharpPhpOptions options) { _options = options; }