Bravo3\Orm\Services\ScoreNormaliser::scoreString PHP Method

scoreString() public method

Return the score of a string as a numeric representation
public scoreString ( string $item ) : float
$item string
return float
    public function scoreString($item)
    {
        $scored = 0;
        $score = '';
        $index = 0;
        $length = strlen($item);
        while ($scored < 7) {
            $c = $index < $length ? $this->getCharacterScore($item[$index++]) : '00';
            if ($c === null) {
                continue;
            }
            $score .= $c;
            if (++$scored == 4) {
                $score .= '.';
            }
        }
        return $this->scoreNumber($score);
    }