PHP 클래스 DiffMatchPatch\DiffToolkit

저자: Neil Fraser ([email protected])
저자: Daniil Skrobov ([email protected])
파일 보기 프로젝트 열기: yetanotherape/diff-match-patch

공개 메소드들

메소드 설명
charsToLines ( array &$diffs, array $lineArray ) Rehydrate the text in a diff from a string of line hashes to real lines of text.
commonPrefix ( string $text1, string $text2 ) : integer Determine the common prefix of two strings.
commonSuffix ( string $text1, string $text2 ) : integer Determine the common suffix of two strings.
commontOverlap ( string $text1, string $text2 ) : integer Determine if the suffix of one string is the prefix of another.
halfMatch ( string $text1, string $text2 ) : null | array Do the two texts share a substring which is at least half the length of the longer text? This speedup can produce non-minimal diffs.
linesToChars ( string $text1, string $text2 ) : array Split two texts into an array of strings. Reduce the texts to a string of hashes where each Unicode character represents one line.

보호된 메소드들

메소드 설명
halfMatchI ( string $longtext, string $shorttext, integer $i ) : null | array Does a substring of shorttext exist within longtext such that the substring is at least half the length of longtext?
linesToCharsMunge ( string $text, array &$lineArray, array &$lineHash ) : string Split a text into an array of strings. Reduce the texts to a string of hashes where each Unicode character represents one line.

메소드 상세

charsToLines() 공개 메소드

Modifies $diffs. TODO try to fix it!
public charsToLines ( array &$diffs, array $lineArray )
$diffs array Array of diff arrays.
$lineArray array Array of unique strings.

commonPrefix() 공개 메소드

Determine the common prefix of two strings.
public commonPrefix ( string $text1, string $text2 ) : integer
$text1 string First string.
$text2 string Second string.
리턴 integer The number of characters common to the start of each string.

commonSuffix() 공개 메소드

Determine the common suffix of two strings.
public commonSuffix ( string $text1, string $text2 ) : integer
$text1 string First string.
$text2 string Second string.
리턴 integer The number of characters common to the end of each string.

commontOverlap() 공개 메소드

Determine if the suffix of one string is the prefix of another.
public commontOverlap ( string $text1, string $text2 ) : integer
$text1 string First string.
$text2 string Second string.
리턴 integer The number of characters common to the end of the first string and the start of the second string.

halfMatch() 공개 메소드

Do the two texts share a substring which is at least half the length of the longer text? This speedup can produce non-minimal diffs.
public halfMatch ( string $text1, string $text2 ) : null | array
$text1 string First string.
$text2 string Second string.
리턴 null | array Five element array, containing the prefix of text1, the suffix of text1, the prefix of text2, the suffix of text2 and the common middle. Or null if there was no match.

halfMatchI() 보호된 메소드

Does a substring of shorttext exist within longtext such that the substring is at least half the length of longtext?
protected halfMatchI ( string $longtext, string $shorttext, integer $i ) : null | array
$longtext string Longer string.
$shorttext string Shorter string.
$i integer Start index of quarter length substring within longtext.
리턴 null | array Five element array, containing the prefix of longtext, the suffix of longtext, the prefix of shorttext, the suffix of shorttext and the common middle. Or null if there was no match.

linesToChars() 공개 메소드

Split two texts into an array of strings. Reduce the texts to a string of hashes where each Unicode character represents one line.
public linesToChars ( string $text1, string $text2 ) : array
$text1 string First string.
$text2 string Second string.
리턴 array Three element array, containing the encoded text1, the encoded text2 and the array of unique strings. The zeroth element of the array of unique strings is intentionally blank.

linesToCharsMunge() 보호된 메소드

Modifies $lineArray and $lineHash. TODO try to fix it!
protected linesToCharsMunge ( string $text, array &$lineArray, array &$lineHash ) : string
$text string String to encode.
$lineArray array
$lineHash array
리턴 string Encoded string.