Copied!

RandomScore

RandomScore.php : 15
Final
Extends Criterion

Properties

public $operator

Criterion.php : 21

The operator used by the Criterion.

public string $operator

public $target

Criterion.php : 33

The target used by the criteria (field, metadata...).

public string|null $target

public $value

Criterion.php : 28

The value(s) matched by the criteria.

public array<string|int, scalar>|scalar $value

public $valueData

Criterion.php : 38

Additional value data, required by some criteria, MapLocationDistance for instance.

public Value|null $valueData

Methods

public__construct()

RandomScore.php : 21

Creates a Criterion.

public __construct(CriterionInterface $criterion[, int|null $seed = null ])

Performs operator validation based on the Criterion specifications returned by Criterion::getSpecifications().

Parameters

Name Type Default value Description
$criterion CriterionInterface - -
$seed int|null null -

publicgetCriterion()

RandomScore.php : 32
public getCriterion() : CriterionInterface

Return values

CriterionInterface

publicgetSeed()

RandomScore.php : 37
public getSeed() : int|null

Return values

int|null

publicgetSpecifications()

RandomScore.php : 27

Criterion description function.

public getSpecifications() : array<int, Specifications>

Returns the combination of the Criterion's supported operator/value, as an array of Specifications objects

// IN and EQ are supported
return [
    // The EQ operator expects a single value, either as an integer or a string
    new Specifications(
        Operator::EQ,
        Specifications::FORMAT_SINGLE,
        Specifications::TYPE_INTEGER | Specifications::TYPE_STRING
    ),
    // The IN operator expects an array of values, of either integers or strings
    new Specifications(
        Operator::IN,
        Specifications::FORMAT_ARRAY,
        Specifications::TYPE_INTEGER | Specifications::TYPE_STRING
    )
]

Return values

array<int, Specifications>

publichasSeed()

RandomScore.php : 42
public hasSeed() : bool

Return values

bool