Documentation

Guess
in package

AbstractYes

Base class for guesses made by TypeGuesserInterface implementation.

Each instance contains a confidence value about the correctness of the guess. Thus an instance with confidence HIGH_CONFIDENCE is more likely to be correct than an instance with confidence LOW_CONFIDENCE.

Tags
author

Bernhard Schussek bschussek@gmail.com

Table of Contents

Constants

HIGH_CONFIDENCE  = 2
Marks an instance with a value that is very likely to be correct.
LOW_CONFIDENCE  = 0
Marks an instance with a value that may be correct.
MEDIUM_CONFIDENCE  = 1
Marks an instance with a value that is likely to be correct.
VERY_HIGH_CONFIDENCE  = 3
Marks an instance with a value that is extremely likely to be correct.

Properties

$confidence  : int
The confidence about the correctness of the value.

Methods

__construct()  : mixed
getBestGuess()  : static|null
Returns the guess most likely to be correct from a list of guesses.
getConfidence()  : int
Returns the confidence that the guessed value is correct.

Constants

HIGH_CONFIDENCE

Marks an instance with a value that is very likely to be correct.

public mixed HIGH_CONFIDENCE = 2

LOW_CONFIDENCE

Marks an instance with a value that may be correct.

public mixed LOW_CONFIDENCE = 0

MEDIUM_CONFIDENCE

Marks an instance with a value that is likely to be correct.

public mixed MEDIUM_CONFIDENCE = 1

VERY_HIGH_CONFIDENCE

Marks an instance with a value that is extremely likely to be correct.

public mixed VERY_HIGH_CONFIDENCE = 3

Properties

$confidence

The confidence about the correctness of the value.

private int $confidence

One of VERY_HIGH_CONFIDENCE, HIGH_CONFIDENCE, MEDIUM_CONFIDENCE and LOW_CONFIDENCE.

Methods

__construct()

public __construct(int $confidence) : mixed
Parameters
$confidence : int
Tags
throws
InvalidArgumentException

if the given value of confidence is unknown

getBestGuess()

Returns the guess most likely to be correct from a list of guesses.

public static getBestGuess(array<string|int, static> $guesses) : static|null

If there are multiple guesses with the same, highest confidence, the returned guess is any of them.

Parameters
$guesses : array<string|int, static>

An array of guesses

Return values
static|null

getConfidence()

Returns the confidence that the guessed value is correct.

public getConfidence() : int
Return values
int

One of the constants VERY_HIGH_CONFIDENCE, HIGH_CONFIDENCE, MEDIUM_CONFIDENCE and LOW_CONFIDENCE


        
On this page

Search results