From 263232460f566657cb7e35ba3817d64f351c4068 Mon Sep 17 00:00:00 2001 From: Atul Kumar Date: Thu, 3 Jul 2014 14:33:48 +0530 Subject: [PATCH] Update HtmlDiff.php Instead of adding the files while object initialization, a method getFiles will be helpful. --- HtmlDiff.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/HtmlDiff.php b/HtmlDiff.php index 74a5d35..2a126d3 100644 --- a/HtmlDiff.php +++ b/HtmlDiff.php @@ -18,6 +18,17 @@ public function __construct( $oldText, $newText, $encoding = 'UTF-8' ) { $this->encoding = $encoding; $this->content = ''; } + + public function getFiles($files = array()) { + $oldText = (isset($files['oldText']) ? $files['oldText'] : ''); + $newText = (isset($files['newText']) ? $files['newText'] : ''); + $encoding = (isset($arr['encoding']) ? $arr['encoding'] : 'UTF-8'); + + $this->oldText = $this->purifyHtml( trim( $oldText ) ); + $this->newText = $this->purifyHtml( trim( $newText ) ); + $this->encoding = $encoding; + $this->content = ''; + } public function getOldHtml() { return $this->oldText;