PHP Класс SimilarText\Finder

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$haystack Haystack
$needle Needle
$sorted_haystack Hold the sorted comparison stack.

Открытые методы

Метод Описание
__construct ( string $needle, array $haystack ) : void Finder constructor.
all ( ) : array Return all strings in sorted match order.
first ( ) : mixed Return the highest match.
hasExactMatch ( ) : boolean Return whether there is an exact match.

Защищенные методы

Метод Описание
levenshteinUtf8 ( string $string1, string $string2 ) : integer Calculate the levenshtein distance between two strings.
sortHaystack ( ) : void Sort Haystack.
utf8ToExtendedAscii ( string $str, array &$map ) : string Ensure a string only uses ascii characters.

Описание методов

__construct() публичный Метод

Finder constructor.
public __construct ( string $needle, array $haystack ) : void
$needle string
$haystack array
Результат void

all() публичный Метод

Return all strings in sorted match order.
public all ( ) : array
Результат array

first() публичный Метод

Return the highest match.
public first ( ) : mixed
Результат mixed

hasExactMatch() публичный Метод

Return whether there is an exact match.
public hasExactMatch ( ) : boolean
Результат boolean

levenshteinUtf8() защищенный Метод

Calculate the levenshtein distance between two strings.
protected levenshteinUtf8 ( string $string1, string $string2 ) : integer
$string1 string
$string2 string
Результат integer

sortHaystack() защищенный Метод

Sort Haystack.
protected sortHaystack ( ) : void
Результат void

utf8ToExtendedAscii() защищенный Метод

Ensure a string only uses ascii characters.
protected utf8ToExtendedAscii ( string $str, array &$map ) : string
$str string
$map array
Результат string

Описание свойств

$haystack защищенное свойство

Haystack
protected $haystack

$needle защищенное свойство

Needle
protected $needle

$sorted_haystack защищенное свойство

Hold the sorted comparison stack.
protected $sorted_haystack