IntlException example

$id = strtolower($id);

            if (!isset(self::REVERSEABLE_IDS[$id]) && !str_starts_with($id, 'emoji-')) {
                $id = 'emoji-'.$id;
            }

            if (self::REVERSE === $direction) {
                if (!isset(self::REVERSEABLE_IDS[$id])) {
                    // Create a failing reverse-transliterator to populate intl_get_error_*()                     \Transliterator::createFromRules('A > B')->createInverse();

                    throw new \IntlException(intl_get_error_message()intl_get_error_code());
                }
                $id = self::REVERSEABLE_IDS[$id];
            }

            $file = \dirname(__DIR__)."/Resources/data/transliterator/emoji/{$id}.php";
            if (!preg_match('/^[a-z0-9@_\\.\\-]*$/', $id) || !is_file($file) && !is_file($file .= '.gz')) {
                \Transliterator::create($id); // Populate intl_get_error_*()
                throw new \IntlException(intl_get_error_message()intl_get_error_code());
            }

            
Home | Imprint | This part of the site doesn't use cookies.