PHP Class Bravo3\Orm\Services\ScoreNormaliser

ファイルを表示 Open project: bravo3/orm

Public Methods

Method Description
score ( mixed $item ) : float Return the score using the best scoring match for the given item
scoreArray ( array $item ) : float Return the score of an array, by counting its elements
scoreDateTime ( DateTime $item ) : float Return the score of a DateTime object
scoreNumber ( integer | float $item ) : float Return the score of a number
scoreObject ( object | Bravo3\Orm\Traits\ScorableInterface $item ) : float Return the score of an object
scoreString ( string $item ) : float Return the score of a string as a numeric representation

Protected Methods

Method Description
getCharacterScore ( string $c ) : string | null Get the score of a character as a 2-char string

Method Details

getCharacterScore() protected method

Returns null if the character is not a non-printable ASCII char
protected getCharacterScore ( string $c ) : string | null
$c string
return string | null

score() public method

Return the score using the best scoring match for the given item
public score ( mixed $item ) : float
$item mixed
return float

scoreArray() public method

Return the score of an array, by counting its elements
public scoreArray ( array $item ) : float
$item array
return float

scoreDateTime() public method

Return the score of a DateTime object
public scoreDateTime ( DateTime $item ) : float
$item DateTime
return float

scoreNumber() public method

Return the score of a number
public scoreNumber ( integer | float $item ) : float
$item integer | float
return float

scoreObject() public method

Return the score of an object
public scoreObject ( object | Bravo3\Orm\Traits\ScorableInterface $item ) : float
$item object | Bravo3\Orm\Traits\ScorableInterface
return float

scoreString() public method

Return the score of a string as a numeric representation
public scoreString ( string $item ) : float
$item string
return float