src/I18n/Gettext/Languages/FormulaConverter.php
private static function convertAtom($cldrAtom)
    {
        $m = null;
        $gettextAtom = $cldrAtom;
        $gettextAtom = \str_replace([' = ', 'i'], [' == ', 'n'], $gettextAtom);

        if (\preg_match('/^n( % \d+)? (!=|==) \d+$/', $gettextAtom)) {
            return $gettextAtom;
        }
        if (\preg_match('/^n( % \d+)? (!=|==) \d+(,\d+|\.\.\d+)+$/', $gettextAtom)) {
            return self::expandAtom($gettextAtom);
        }
        if (\preg_match('/^(?:v|w)(?: % 10+)? == (\d+)(?:\.\.\d+)?$/', $gettextAtom,
            $m)) { // For gettext: v == 0, w == 0
            return ((int) $m[1]) === 0;
        }
        if (\preg_match('/^(?:v|w)(?: % 10+)? != (\d+)(?:\.\.\d+)?$/', $gettextAtom,
            $m)) { // For gettext: v == 0, w == 0
            return ((int) $m[1]) !== 0;
        }
        if (\preg_match('/^(?:f|t)(?: % 10+)? == (\d+)(?:\.\.\d+)?$/', $gettextAtom, $m)) { // f == empty, t == empty
            return ((int) $m[1]) === 0;
        }
        if (\preg_match('/^(?:f|t)(?: % 10+)? != (\d+)(?:\.\.\d+)?$/', $gettextAtom, $m)) { // f == empty, t == empty
            return ((int) $m[1]) !== 0;
        }

        throw new \InvalidArgumentException("Unable to convert the formula chunk '$cldrAtom' from CLDR to gettext");
    }
private static function convertAtom($cldrAtom)
    {
        $m = null;
        $gettextAtom = $cldrAtom;
        $gettextAtom = \str_replace([' = ', 'i'], [' == ', 'n'], $gettextAtom);

        if (\preg_match('/^n( % \d+)? (!=|==) \d+$/', $gettextAtom)) {
            return $gettextAtom;
        }
        if (\preg_match('/^n( % \d+)? (!=|==) \d+(,\d+|\.\.\d+)+$/', $gettextAtom)) {
            return self::expandAtom($gettextAtom);
        }
        if (\preg_match('/^(?:v|w)(?: % 10+)? == (\d+)(?:\.\.\d+)?$/', $gettextAtom,
            $m)) { // For gettext: v == 0, w == 0
            return ((int) $m[1]) === 0;
        }
        if (\preg_match('/^(?:v|w)(?: % 10+)? != (\d+)(?:\.\.\d+)?$/', $gettextAtom,
            $m)) { // For gettext: v == 0, w == 0
            return ((int) $m[1]) !== 0;
        }
        if (\preg_match('/^(?:f|t)(?: % 10+)? == (\d+)(?:\.\.\d+)?$/', $gettextAtom, $m)) { // f == empty, t == empty
            return ((int) $m[1]) === 0;
        }
        if (\preg_match('/^(?:f|t)(?: % 10+)? != (\d+)(?:\.\.\d+)?$/', $gettextAtom, $m)) { // f == empty, t == empty
            return ((int) $m[1]) !== 0;
        }

        throw new \InvalidArgumentException("Unable to convert the formula chunk '$cldrAtom' from CLDR to gettext");
    }
private static function convertAtom ( $ cldrAtom ) { $ m = null ; $ gettextAtom = $ cldrAtom ; $ gettextAtom = \ str_replace ( [ ' = ' , 'i' ] , [ ' == ' , 'n' ] , $ gettextAtom ) ; if ( \ preg_match ( '/^n( % \d+)? (!=|==) \d+$/' , $ gettextAtom ) ) { return $ gettextAtom ; } if ( \ preg_match ( '/^n( % \d+)? (!=|==) \d+(,\d+|\.\.\d+)+$/' , $ gettextAtom ) ) { return self :: expandAtom ( $ gettextAtom ) ; } if ( \ preg_match ( '/^(?:v|w)(?: % 10+)? == (\d+)(?:\.\.\d+)?$/' , $ gettextAtom , $ m ) ) { // For gettext: v == 0, w == 0 return ( ( int ) $ m [ 1 ] ) === 0 ; } if ( \ preg_match ( '/^(?:v|w)(?: % 10+)? != (\d+)(?:\.\.\d+)?$/' , $ gettextAtom , $ m ) ) { // For gettext: v == 0, w == 0 return ( ( int ) $ m [ 1 ] ) !== 0 ; } if ( \ preg_match ( '/^(?:f|t)(?: % 10+)? == (\d+)(?:\.\.\d+)?$/' , $ gettextAtom , $ m ) ) { // f == empty, t == empty return ( ( int ) $ m [ 1 ] ) === 0 ; } if ( \ preg_match ( '/^(?:f|t)(?: % 10+)? != (\d+)(?:\.\.\d+)?$/' , $ gettextAtom , $ m ) ) { // f == empty, t == empty return ( ( int ) $ m [ 1 ] ) !== 0 ; } throw new \ InvalidArgumentException ( "Unable to convert the formula chunk '$cldrAtom' from CLDR to gettext" ) ; }
Converts an atomic part of the CLDR formula to its gettext representation.

@param string $cldrAtom The CLDR formula atom to convert.

@throws \InvalidArgumentException
@return bool|string Returns true if the gettext will always evaluate to true, false if gettext will always evaluate to false, return the gettext formula otherwise.
Converts an atomic part of the CLDR formula to its gettext representation .