Returns the relevant pattern for the given number.

@param string $value
@param string $translationId
@return string
186278
protected function getPattern($value, $translationId)
    {
        $language = $this->translator->getCurrentLanguage();

        if (!isset($this->patterns[$language][$translationId])) {
            $this->patterns[$language][$translationId] = $this->parsePattern($this->translator->translate($translationId));
        }

        list($positivePattern, $negativePattern) = $this->patterns[$language][$translationId];
        $negative = $this->isNegative($value);

        return $negative ? $negativePattern : $positivePattern;
    }
1183488
protected function _domId($value)
    {
        $domId = mb_strtolower(Text::slug($value, '-'));
        if ($this->_idPrefix) {
            $domId = $this->_idPrefix . '-' . $domId;
        }

        return $domId;
    }
1279581
public static function getCountryTranslation($value, $locale = null)
    {
        trigger_error("The method getCountryTranslation is deprecated. Use getTranslation($value, 'country', $locale) instead", E_USER_NOTICE);
        return self::getTranslation($value, 'country', $locale);
    }
782655
public static function create($value)
    {
        try {
            $expr = new RegexExpression($value);
            return $expr;
        } catch(\Exception $E) {
            $expr = new GlobExpression($value);
            return $expr;
        }
    }
210491
public static function getLanguageTranslation($value, $locale = null)
    {
        trigger_error("The method getLanguageTranslation is deprecated. Use getTranslation($value, 'language', $locale) instead", E_USER_NOTICE);
        return self::getTranslation($value, 'language', $locale);
    }
161880
protected function numberToEnglish(string $value): string
    {
        if ('.' !== $this->getDecimalPoint()) {
            return str_replace($this->getDecimalPoint(), '.', $value);
        }
        return $value;
    }
979050
public function filter($value)
    {
        $replace = $this->getReplaceCallback();
        $filtered = $value;

        foreach ($this->patterns as $index => $pattern)
        {
            $filtered = preg_replace_callback($pattern, $replace[$index], $filtered);
        }

        return $filtered;
    }
401837
public function trans(string $value, string $lang = null):?string
    {
        $locale = $this->applocale;
        if (null !== $lang) {
            $this->applyMatchLocale($lang);
        }

        if (in_array($locale->getTranstype(), $this->transType)) {
            switch ($locale->getTranstype()) {
                case 'poedit':
                    return (_($value));
                   break;
                case 'json':
                    $file = JsonListener::open(FEnv::get("app.locale.content.file"));
                    return ($file->$value);
                    break;
            }
        }
        return (null);
    }
695174
public function transform($value): ?string
    {
        if (null === $value) {
            return '';
        }

        if (!$value instanceof MoneyValue) {
            throw new TransformationFailedException('Expected a MoneyValue object.');
        }

        if (!$this->formatter) {
            $this->formatter = new DecimalMoneyFormatter(new ISOCurrencies());
        }

        if (!$value->withCurrency) {
            return $this->formatter->format($value->value);
        }

        return ((string) $value->value->getCurrency()).' '.$this->formatter->format($value->value);
    }
1124154
private function detectErrorId(string $value): string
    {
        if (preg_match('/\s/i', $value) != false) {
            return 'MAILADDRESS_CANNOT_CONTAIN_SPACES';
        }

        if (preg_match('/[äüöß]/i', $value) != false) {
            return 'MAILADDRESS_CANNOT_CONTAIN_UMLAUTS';
        }

        if (substr_count($value, '@') != 1) {
            return 'MAILADDRESS_MUST_CONTAIN_ONE_AT';
        }

        if (strpos($value, '.@') !== false || strpos($value, '@.') !== false) {
            return 'MAILADDRESS_DOT_NEXT_TO_AT_SIGN';
        }

        if (strpos($value, '..') !== false) {
            return 'MAILADDRESS_CONTAINS_TWO_FOLLOWING_DOTS';
        }

        return 'MAILADDRESS_INCORRECT';
    }
622950
protected function translateTokenFromIdentifier($identifier, $value)
    {
        $result = null;

        if (array_key_exists($identifier, self::$tokenValueMap)) {
            $result = $this->translateTokenUsingMap($identifier);
        } elseif (array_key_exists($identifier, self::$tokenCallbackMap)) {
            $result = $this->translateTokenUsingCallback($identifier, $value);
        }

        return $result;
    }
342294
public function displayValue( $value )
    {
        return $this->view->translate(
            ( empty( $this->translatePrefix )
              ? '' : $this->translatePrefix . '.' ) .
            $value .
            ( empty( $this->translatePostfix )
              ? '' : '.' . $this->translatePostfix ),
            $this->translateTextDomain
        );
    }
274416
public function filter($value, $pattern, $replacement = '', $limit = -1)
    {
        $this->assertNoEval($pattern);
        
        if (!isset($value)) {
            return null;
        }
        
        return preg_filter($pattern, $replacement, $value, $limit);
    }
705080
public function getPrettyNumber($value, $precision = 0)
    {
        if ($this->decimalPoint === null) {
            $locale = localeconv();

            $this->decimalPoint = $locale['decimal_point'];
            $this->thousandsSeparator = $locale['thousands_sep'];
        }

        return number_format($value, $precision, $this->decimalPoint, $this->thousandsSeparator);
    }
59840
public function filter($value) {
        if (preg_match(Garp_Validate_DutchPostalCode::POSTALCODE_REGEXP, $value, $matches)) {
            return $matches[1] . strtoupper($matches[2]);
        }
        return $value;
    }
655740
protected function formatNumberWithPattern($pattern, $value, $maximumFractionDigits=0, $minimumFractionDigits=0)
    {
        if (!is_numeric($value)) {
            return $value;
        }

        $usesGrouping = (strpos($pattern, ',') !== false);
        // if pattern has number groups, parse them.
        if ($usesGrouping) {
            preg_match('/#+0/', $pattern, $primaryGroupMatches);
            $primaryGroupSize = $secondaryGroupSize = strlen($primaryGroupMatches[0]);
            $numberGroups = explode(',', $pattern);
            // check for distinct secondary group size.
            if (count($numberGroups) > 2) {
                $secondaryGroupSize = strlen($numberGroups[1]);
            }
        }

        // Ensure that the value is positive and has the right number of digits.
        $negative = $this->isNegative($value);
        $signMultiplier = $negative ? '-1' : '1';
        $value = $value / $signMultiplier;
        $value = round($value, $maximumFractionDigits);
        // Split the number into major and minor digits.
        $valueParts = explode('.', $value);
        $majorDigits = $valueParts[0];
        // Account for maximumFractionDigits = 0, where the number won't
        // have a decimal point, and $valueParts[1] won't be set.
        $minorDigits = isset($valueParts[1]) ? $valueParts[1] : '';
        if ($usesGrouping) {
            // Reverse the major digits, since they are grouped from the right.
            $majorDigits = array_reverse(str_split($majorDigits));
            // Group the major digits.
            $groups = array();
            $groups[] = array_splice($majorDigits, 0, $primaryGroupSize);
            while (!empty($majorDigits)) {
                $groups[] = array_splice($majorDigits, 0, $secondaryGroupSize);
            }
            // Reverse the groups and the digits inside of them.
            $groups = array_reverse($groups);
            foreach ($groups as &$group) {
                $group = implode(array_reverse($group));
            }
            // Reconstruct the major digits.
            $majorDigits = implode(',', $groups);
        }
        if ($minimumFractionDigits < $maximumFractionDigits) {
            // Strip any trailing zeroes.
            $minorDigits = rtrim($minorDigits, '0');
            if (strlen($minorDigits) < $minimumFractionDigits) {
                // Now there are too few digits, re-add trailing zeroes
                // until the desired length is reached.
                $neededZeroes = $minimumFractionDigits - strlen($minorDigits);
                $minorDigits .= str_repeat('0', $neededZeroes);
            }
        }
        // Assemble the final number and insert it into the pattern.
        $value = $minorDigits ? $majorDigits . '.' . $minorDigits : $majorDigits;
        $value = preg_replace('/#(?:[\.,]#+)*0(?:[,\.][0#]+)*/', $value, $pattern);
        // Localize the number.
        $value = $this->replaceSymbols($value);
        return $value;
    }
133458
protected function processScalarValue($value)/*# : string */
    {
        if (ClauseInterface::NO_VALUE == $value) {
            return '?';
        } elseif (is_null($value) || is_bool($value)) {
            return strtoupper(var_export($value, true));
        } else {
            return $this->getBuilder()->getParameter()->getPlaceholder($value);
        }
    }