bootstrap.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. use Symfony\Polyfill\Intl\Grapheme as p;
  11. if (\PHP_VERSION_ID >= 80000) {
  12. return require __DIR__.'/bootstrap80.php';
  13. }
  14. if (!class_exists('ValueError', false)) {
  15. class ValueError extends Error
  16. {
  17. }
  18. }
  19. if (!defined('GRAPHEME_EXTR_COUNT')) {
  20. define('GRAPHEME_EXTR_COUNT', 0);
  21. }
  22. if (!defined('GRAPHEME_EXTR_MAXBYTES')) {
  23. define('GRAPHEME_EXTR_MAXBYTES', 1);
  24. }
  25. if (!defined('GRAPHEME_EXTR_MAXCHARS')) {
  26. define('GRAPHEME_EXTR_MAXCHARS', 2);
  27. }
  28. if (!function_exists('grapheme_extract')) {
  29. function grapheme_extract($haystack, $size, $type = 0, $start = 0, &$next = 0) { return p\Grapheme::grapheme_extract($haystack, $size, $type, $start, $next); }
  30. }
  31. if (!function_exists('grapheme_stripos')) {
  32. function grapheme_stripos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_stripos($haystack, $needle, $offset); }
  33. }
  34. if (!function_exists('grapheme_stristr')) {
  35. function grapheme_stristr($haystack, $needle, $beforeNeedle = false) { return p\Grapheme::grapheme_stristr($haystack, $needle, $beforeNeedle); }
  36. }
  37. if (!function_exists('grapheme_strlen')) {
  38. function grapheme_strlen($input) { return p\Grapheme::grapheme_strlen($input); }
  39. }
  40. if (!function_exists('grapheme_strpos')) {
  41. function grapheme_strpos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strpos($haystack, $needle, $offset); }
  42. }
  43. if (!function_exists('grapheme_strripos')) {
  44. function grapheme_strripos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strripos($haystack, $needle, $offset); }
  45. }
  46. if (!function_exists('grapheme_strrpos')) {
  47. function grapheme_strrpos($haystack, $needle, $offset = 0) { return p\Grapheme::grapheme_strrpos($haystack, $needle, $offset); }
  48. }
  49. if (!function_exists('grapheme_strstr')) {
  50. function grapheme_strstr($haystack, $needle, $beforeNeedle = false) { return p\Grapheme::grapheme_strstr($haystack, $needle, $beforeNeedle); }
  51. }
  52. if (!function_exists('grapheme_substr')) {
  53. function grapheme_substr($string, $offset, $length = null) { return p\Grapheme::grapheme_substr($string, $offset, $length); }
  54. }
  55. if (!function_exists('grapheme_str_split')) {
  56. function grapheme_str_split(string $string, int $length = 1) { return p\Grapheme::grapheme_str_split($string, $length); }
  57. }
  58. if (!function_exists('grapheme_levenshtein')) {
  59. function grapheme_levenshtein(string $string1, string $string2, int $insertion_cost = 1, int $replacement_cost = 1, int $deletion_cost = 1, string $locale = '') { return p\Grapheme::grapheme_levenshtein($string1, $string2, $insertion_cost, $replacement_cost, $deletion_cost); }
  60. }
  61. if (!function_exists('grapheme_strrev')) {
  62. function grapheme_strrev(string $string) { return p\Grapheme::grapheme_strrev($string); }
  63. }