forked from Zodiac1978/tl-normalizer
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathNormalizer.php
More file actions
49 lines (44 loc) · 1.62 KB
/
Normalizer.php
File metadata and controls
49 lines (44 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
// gitlost removed namespace stuff, renamed to UNFC_Normalizer to avoid conflicts.
// gitlost moved body of code to UNFC_BaseNormalizer to cater for change of consts for PHP >= 7.3 with ICU >= 56.
// https://github.com/symfony/polyfill/tree/master/src/Intl/Normalizer
// namespace Symfony\Polyfill\Intl\Normalizer; // gitlost
require dirname( __FILE__ ) . '/BaseNormalizer.php';
/**
* Normalizer is a PHP fallback implementation of the Normalizer class provided by the intl extension.
*
* It has been validated with Unicode 12.1.0 Normalization Conformance Test. // gitlost
* See http://www.unicode.org/reports/tr15/ for detailed info about Unicode normalizations.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
// PHP >= 7.3 with ICU >= 56 changed the values of the Normalizer consts for some reason, and also added new const FORM_KC_CF for case-folding.
if ( version_compare( PHP_VERSION, '7.3', '>=' ) && version_compare( INTL_ICU_VERSION, '56', '>=' ) ) {
class UNFC_Normalizer extends UNFC_BaseNormalizer {
const NONE = 0x2;
const FORM_D = 0x4;
const FORM_KD = 0x8;
const FORM_C = 0x10;
const FORM_KC = 0x20;
const FORM_KC_CF = 0x30;
}
} else {
class UNFC_Normalizer extends UNFC_BaseNormalizer {
const NONE = 1;
const FORM_D = 2;
const FORM_KD = 3;
const FORM_C = 4;
const FORM_KC = 5;
const FORM_KC_CF = 0x30; // Define this anyway as functionality available
}
}