src/I18n/Gettext/Languages/Language.php
private static function reverseFormula($formula)
    {
        if (\preg_match('/^n( % \d+)? == \d+(\.\.\d+|,\d+)*?$/', $formula)) {
            return \str_replace(' == ', ' != ', $formula);
        }
        if (\preg_match('/^n( % \d+)? != \d+(\.\.\d+|,\d+)*?$/', $formula)) {
            return \str_replace(' != ', ' == ', $formula);
        }
        if (\preg_match('/^\(?n == \d+ \|\| n == \d+\)?$/', $formula)) {
            return \trim(\str_replace([' == ', ' || '], [' != ', ' && '], $formula), '()');
        }
        $m = null;
        if (\preg_match('/^(n(?: % \d+)?) == (\d+) && (n(?: % \d+)?) != (\d+)$/', $formula, $m)) {
            return "{$m[1]} != {$m[2]} || {$m[3]} == {$m[4]}";
        }
        switch ($formula) {
            case '(n == 1 || n == 2 || n == 3) || n % 10 != 4 && n % 10 != 6 && n % 10 != 9':
                return 'n != 1 && n != 2 && n != 3 && (n % 10 == 4 || n % 10 == 6 || n % 10 == 9)';
            case '(n == 0 || n == 1) || n >= 11 && n <= 99':
                return 'n >= 2 && (n < 11 || n > 99)';
        }
        throw new \InvalidArgumentException("Unable to reverse the formula '$formula'");
    }
private static function reverseFormula($formula)
    {
        if (\preg_match('/^n( % \d+)? == \d+(\.\.\d+|,\d+)*?$/', $formula)) {
            return \str_replace(' == ', ' != ', $formula);
        }
        if (\preg_match('/^n( % \d+)? != \d+(\.\.\d+|,\d+)*?$/', $formula)) {
            return \str_replace(' != ', ' == ', $formula);
        }
        if (\preg_match('/^\(?n == \d+ \|\| n == \d+\)?$/', $formula)) {
            return \trim(\str_replace([' == ', ' || '], [' != ', ' && '], $formula), '()');
        }
        $m = null;
        if (\preg_match('/^(n(?: % \d+)?) == (\d+) && (n(?: % \d+)?) != (\d+)$/', $formula, $m)) {
            return "{$m[1]} != {$m[2]} || {$m[3]} == {$m[4]}";
        }
        switch ($formula) {
            case '(n == 1 || n == 2 || n == 3) || n % 10 != 4 && n % 10 != 6 && n % 10 != 9':
                return 'n != 1 && n != 2 && n != 3 && (n % 10 == 4 || n % 10 == 6 || n % 10 == 9)';
            case '(n == 0 || n == 1) || n >= 11 && n <= 99':
                return 'n >= 2 && (n < 11 || n > 99)';
        }
        throw new \InvalidArgumentException("Unable to reverse the formula '$formula'");
    }
private static function reverseFormula ( $ formula ) { if ( \ preg_match ( '/^n( % \d+)? == \d+(\.\.\d+|,\d+)*?$/' , $ formula ) ) { return \ str_replace ( ' == ' , ' != ' , $ formula ) ; } if ( \ preg_match ( '/^n( % \d+)? != \d+(\.\.\d+|,\d+)*?$/' , $ formula ) ) { return \ str_replace ( ' != ' , ' == ' , $ formula ) ; } if ( \ preg_match ( '/^\(?n == \d+ \|\| n == \d+\)?$/' , $ formula ) ) { return \ trim ( \ str_replace ( [ ' == ' , ' || ' ] , [ ' != ' , ' && ' ] , $ formula ) , '()' ) ; } $ m = null ; if ( \ preg_match ( '/^(n(?: % \d+)?) == (\d+) && (n(?: % \d+)?) != (\d+)$/' , $ formula , $ m ) ) { return "{$m[1]} != {$m[2]} || {$m[3]} == {$m[4]}" ; } switch ( $ formula ) { case '(n == 1 || n == 2 || n == 3) || n % 10 != 4 && n % 10 != 6 && n % 10 != 9' : return 'n != 1 && n != 2 && n != 3 && (n % 10 == 4 || n % 10 == 6 || n % 10 == 9)' ; case '(n == 0 || n == 1) || n >= 11 && n <= 99' : return 'n >= 2 && (n < 11 || n > 99)' ; } throw new \ InvalidArgumentException ( "Unable to reverse the formula '$formula'" ) ; }
Reverse a formula.

@param string $formula

@throws \InvalidArgumentException
@return string
Reverse a formula .