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