Merge pull request #899 from pytesNET/master

Remove Static Declarations
This commit is contained in:
Diego Najar 2018-12-31 09:02:58 +01:00 committed by GitHub
commit bec7336044
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 11 deletions

View File

@ -1,4 +1,4 @@
<?php declare(strict_types = 1); <?php
/** /**
* This script was modified to fit in Bludit * This script was modified to fit in Bludit
@ -32,7 +32,7 @@ class Fuzz
* @param int $searchMode 0 = Levenshtein, 1 = Jaro-Winkler * @param int $searchMode 0 = Levenshtein, 1 = Jaro-Winkler
* @param boolean $useLCS Factor in Longest Common Substring in search results * @param boolean $useLCS Factor in Longest Common Substring in search results
*/ */
public function __construct(array $source, int $maxResults, int $searchMode, bool $useLCS) public function __construct($source, $maxResults, $searchMode, $useLCS)
{ {
$this->_source = $source; $this->_source = $source;
$this->_sourceLen = count($source); $this->_sourceLen = count($source);
@ -56,7 +56,7 @@ class Fuzz
* *
* @return array $results Array of associative arrays containing search matches * @return array $results Array of associative arrays containing search matches
*/ */
public function search(string $search, int $minLCS = null, int $maxDistance = null) public function search($search, $minLCS = null, $maxDistance = null)
{ {
$results = []; $results = [];
$scores = []; $scores = [];
@ -121,7 +121,7 @@ class Fuzz
* *
* @return int $result LCS Score * @return int $result LCS Score
*/ */
public function getLCS(string $source, string $target) public function getLCS($source, $target)
{ {
$suffix = []; $suffix = [];
$result = 0; $result = 0;
@ -152,7 +152,7 @@ class Fuzz
* *
* @return int Levenshtein Distance * @return int Levenshtein Distance
*/ */
public function getLevenshtein(string $source, string $target) public function getLevenshtein($source, $target)
{ {
$matrix = []; $matrix = [];
$n = strlen($source); $n = strlen($source);
@ -203,7 +203,7 @@ class Fuzz
* *
* @return double $jaroWinkler Jaro-Winkler score between 0.0 and 1.0 * @return double $jaroWinkler Jaro-Winkler score between 0.0 and 1.0
*/ */
public function getJaroWinkler(string $first, string $second) public function getJaroWinkler($first, $second)
{ {
$shorter; $shorter;
$longer; $longer;
@ -251,7 +251,7 @@ class Fuzz
* *
* @return string $common Common substring * @return string $common Common substring
*/ */
private function _getCharMatch(string $first, string $second, int $limit) private function _getCharMatch($first, $second, $limit)
{ {
$common = ''; $common = '';
$copy = $second; $copy = $second;
@ -282,7 +282,7 @@ class Fuzz
* *
* @return int $trans Number of transpositions between strings * @return int $trans Number of transpositions between strings
*/ */
private function _getTranspositions(string $first, string $second) private function _getTranspositions($first, $second)
{ {
$trans = 0; $trans = 0;
$firstLen = strlen($first); $firstLen = strlen($first);
@ -305,7 +305,7 @@ class Fuzz
* *
* @return string Returns substring representing the longest prefix * @return string Returns substring representing the longest prefix
*/ */
private function _getPrefix(string $first, string $second) private function _getPrefix($first, $second)
{ {
if (strlen($first) == 0 || strlen($second) == 0) { if (strlen($first) == 0 || strlen($second) == 0) {
return ''; return '';
@ -329,7 +329,7 @@ class Fuzz
* *
* @return Return index of first difference * @return Return index of first difference
*/ */
private function _getDiffIndex(string $first, string $second) private function _getDiffIndex($first, $second)
{ {
if ($first == $second) { if ($first == $second) {
return -1; return -1;
@ -353,7 +353,7 @@ class Fuzz
* *
* @return void * @return void
*/ */
private function _printMatrix(array $arr) private function _printMatrix($arr)
{ {
$str = ''; $str = '';
$width = count($arr[0]); $width = count($arr[0]);