You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I like the getInstance() pattern and think that would be a good addition. In regards to the registerPlugin() method, it is static because it is designed to register plugins across all parser instances. For example, let's say you have 4 monitoring servers with 4 different files that you wanted to output as CSV files (CSV doesn't really make sense, but bear with me). With the static method you can register the plugin once and have it be available to all instances. In addition, you can set the default plugin to be "csv" so that you only have to call $parser->render(). If you decide to change the output to XML down the road, you can set the default plugin in one place and have all parsers effected.
It'd be nice if the Parser provided a fluent interface so you could do:
You could also chain your registerPlugin() calls instead of making them static methods.
The text was updated successfully, but these errors were encountered: