You are here

public static function Interval::getIntervalRegexp in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/translation/Interval.php \Symfony\Component\Translation\Interval::getIntervalRegexp()

Returns a Regexp that matches valid intervals.

Return value

string A Regexp (without the delimiters)

2 calls to Interval::getIntervalRegexp()
Interval::test in vendor/symfony/translation/Interval.php
Tests if the given number is in the math interval.
MessageSelector::choose in vendor/symfony/translation/MessageSelector.php
Given a message with different plural translations separated by a pipe (|), this method returns the correct portion of the message based on the given number, locale and the pluralization rules in the message itself.

File

vendor/symfony/translation/Interval.php, line 78

Class

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

Namespace

Symfony\Component\Translation

Code

public static function getIntervalRegexp() {
  return <<<EOF
        ({\\s*
            (\\-?\\d+(\\.\\d+)?[\\s*,\\s*\\-?\\d+(\\.\\d+)?]*)
        \\s*})

            |

        (?P<left_delimiter>[\\[\\]])
            \\s*
            (?P<left>-Inf|\\-?\\d+(\\.\\d+)?)
            \\s*,\\s*
            (?P<right>\\+?Inf|\\-?\\d+(\\.\\d+)?)
            \\s*
        (?P<right_delimiter>[\\[\\]])
EOF;
}