/** * Returns parsed .diff file as array * * @param string Content of unified .diff file to process * @param string Otional path which is prepended to the source name found in the .diff * @param boolean Optional flag for reversing the patching (patch will be removed from destination file) * @return array/string If parsing was sucessful, an array containing the parsed diff data (diffdata), an optional comment (comment), the source file name (source) and the destination file name (destination). * If parsing failed, a string is returned, containing the error msg. */ public static function parseDiff($diffFile, $path = '', $rev = false) { $patcher = new pmkpatcher($path); $diffArray = $patcher->_parseDiff($diffFile, $rev); return is_array($diffArray) ? $diffArray : $patcher->errorMsg; }