src/Match.php
protected function bitapScore($errors, $matchLoc, $patternLen, $searchLoc)
    {
        $accuracy = $errors / $patternLen;
        $proximity = abs($searchLoc - $matchLoc);
        if (!$this->getDistance()) {
            // Dodge divide by zero error.
            return $proximity ? 1.0 : $accuracy;
        }
        return $accuracy + ($proximity/$this->getDistance());
    }
protected function bitapScore($errors, $matchLoc, $patternLen, $searchLoc)
    {
        $accuracy = $errors / $patternLen;
        $proximity = abs($searchLoc - $matchLoc);
        if (!$this->getDistance()) {
            // Dodge divide by zero error.
            return $proximity ? 1.0 : $accuracy;
        }
        return $accuracy + ($proximity/$this->getDistance());
    }
Compute and return the score for a match with e errors and x location.
Accesses loc and pattern through being a closure.

@param int    $errors            Number of errors in match.
@param int    $matchLoc          Location of match.
@param int    $patternLen        Length of pattern to search.
@param int    $searchLoc         The location to search around.
TODO refactor param usage.

@return float Overall score for match (0.0 = good, 1.0 = bad).