class Round extends NumberMutator (View source)

Round a number. By default, this will round to the nearest integer. The precision and mode can be set to change this.

Methods

__construct(int $precision = 0, int $mode = PHP_ROUND_HALF_UP)

No description

mixed
__invoke(mixed $value)

Mutate the input value.

from  Mutator
static Round
make(int $precision = 0, int $mode = PHP_ROUND_HALF_UP)

No description

mixed
mutate(mixed $value)

Mutate the input value.

float|int
mutateNumber(float|int $value)

No description

Details

__construct(int $precision = 0, int $mode = PHP_ROUND_HALF_UP)

No description

Parameters

int $precision

The precision to round to (default: 0). Only applies to RoundDirection::Normal.

int $mode

The mode to round with (default: PHP_ROUND_HALF_UP). Only applies to RoundDirection::Normal.

final mixed __invoke(mixed $value)

Mutate the input value.

Parameters

mixed $value

Return Value

mixed

static Round make(int $precision = 0, int $mode = PHP_ROUND_HALF_UP)

No description

Parameters

int $precision

The precision to round to (default: 0). Only applies to RoundDirection::Normal.

int $mode

The mode to round with (default: PHP_ROUND_HALF_UP). Only applies to RoundDirection::Normal.

Return Value

Round

mixed mutate(mixed $value)

Mutate the input value.

Parameters

mixed $value

Return Value

mixed

protected float|int mutateNumber(float|int $value)

No description

Parameters

float|int $value

Return Value

float|int