FileAccess Orion

Interval
in package

Tests if a given number belongs to a given math interval.

An interval can represent a finite set of numbers:

{1,2,3,4}

An interval can represent numbers between two numbers:

[1, +Inf] ]-1,2[

The left delimiter can be [ (inclusive) or ] (exclusive). The right delimiter can be [ (exclusive) or ] (inclusive). Beside numbers, you can use -Inf and +Inf for the infinite.

Tags
author

Fabien Potencier fabien@symfony.com

see
http://en.wikipedia.org/wiki/Interval_%28mathematics%29#The_ISO_notation
deprecated

since Symfony 4.2, use IdentityTranslator instead

Table of Contents

getIntervalRegexp()  : string
Returns a Regexp that matches valid intervals.
test()  : bool
Tests if the given number is in the math interval.
convertNumber()  : float

Methods

getIntervalRegexp()

Returns a Regexp that matches valid intervals.

public static getIntervalRegexp() : string
Return values
string

A Regexp (without the delimiters)

test()

Tests if the given number is in the math interval.

public static test(int $number, string $interval) : bool
Parameters
$number : int

A number

$interval : string

An interval

Tags
throws
InvalidArgumentException
Return values
bool

convertNumber()

private static convertNumber(string $number) : float
Parameters
$number : string
Return values
float

Search results