From 654bd88ccf6a560e915ef1f40fbb591015fabc04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Fi=C5=A1er?= Date: Thu, 23 Jun 2016 17:56:12 +0200 Subject: [PATCH] Allowed using arrays as $from/$to arguments (preg_match_all does not support array arguments) --- src/Differ.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Differ.php b/src/Differ.php index 4960111e..f4b7723a 100644 --- a/src/Differ.php +++ b/src/Differ.php @@ -134,9 +134,6 @@ public function diff($from, $to, LongestCommonSubsequence $lcs = null) */ public function diffToArray($from, $to, LongestCommonSubsequence $lcs = null) { - preg_match_all('(\r\n|\r|\n)', $from, $fromMatches); - preg_match_all('(\r\n|\r|\n)', $to, $toMatches); - if (is_string($from)) { $from = preg_split('(\r\n|\r|\n)', $from); } @@ -178,14 +175,6 @@ public function diffToArray($from, $to, LongestCommonSubsequence $lcs = null) $common = $lcs->calculate(array_values($from), array_values($to)); $diff = array(); - if (isset($fromMatches[0]) && $toMatches[0] && - count($fromMatches[0]) === count($toMatches[0]) && - $fromMatches[0] !== $toMatches[0]) { - $diff[] = array( - '#Warning: Strings contain different line endings!', 0 - ); - } - foreach ($start as $token) { $diff[] = array($token, 0 /* OLD */); }