caxy / php-htmldiff

A library for comparing two HTML files/snippets and highlighting the differences using simple HTML. Includes support for comparing complex lists and tables
http://php-htmldiff.caxy.com
GNU General Public License v2.0
202 stars 51 forks source link

Create configuration class for HtmlDiff config options #32

Closed jschroed91 closed 8 years ago

jschroed91 commented 8 years ago

Created a new class Caxy\HtmlDiff\HtmlDiffConfig to house the configuration options for HtmlDiff/ListDiff/TableDiff in an object. We've added a decent amount of config options to the HtmlDiff class, and it's getting quite messy having to pass these options individually into each new instance of ListDiff/TableDiff/HtmlDiff that we end up creating. So now we can just pass the object along!

In order to be backwards-compatible, I left the __construct intact as well as the public getter/setter functions for the config options, but I marked them as deprecated.

Use HtmlDiff::setConfig to set the configuration object. The __construct is currently creating a new instance of HtmlDiffConfig with the default options by default, so you don't actually need to create a new object if you don't want to. You can simply call HtmlDiff::getConfig to get the object and then use the (fluent) setter functions to set configuration options.