xref: /PHP-7.1/ext/intl/doc/normalizer_api.php (revision 03f3b847)
1<?php
2
3#############################################################################
4# Object-oriented API
5#############################################################################
6
7/**
8 * Normalizer class.
9 *
10 * Normalizer provides access to Unicode normalization of strings. This class consists
11 * only of static methods. The iterator interface to normalizer is rarely used, so is
12 * not provided here.
13 *
14 * Example:
15 * <code>
16 *
17 * </code>
18 *
19 * @see http://www.icu-project.org/apiref/icu4c/unorm_8h.html
20 * @see http://www.icu-project.org/apiref/icu4c/classNormalizer.html
21 *
22 */
23class Normalizer {
24#############################################################################
25# Common constants.
26#############################################################################
27
28	/**
29	 * Valid normalization form values.
30	 *
31	 * @see Normalizer::normalize()
32	 * @see Normalizer::isNormalize()
33	 * @see normalizer_normalize()
34	 * @see normalizer_is_normalized()
35	*/
36	const NONE    = 1;
37	/** Canonical decomposition. */
38	const NFD = 2;
39	const FORM_D  = NFD;
40	/** Compatibility decomposition. */
41	const NFKD = 3;
42	const FORM_KD = NFKD;
43	/** Canonical decomposition followed by canonical composition. */
44	const NFC = 4;
45	const FORM_C  = NFC;
46	/** Compatibility decomposition followed by canonical composition. */
47	const NFKC =5;
48	const FORM_KC = NFKC;
49
50
51	/**
52	 * Normalizes the input provided and returns the normalized string
53	 * @param   string     $input    The input string to normalize
54	 * @param   [int]      $form     One of the normalization forms
55	 * @return  string               The normalized string or null if an error occurred.
56	*/
57	public static function normalize($input, $form = Normalizer::FORM_C) {}
58
59	/**
60	 * Checks if the provided string is already in the specified normalization form.
61	 * @param  string    $input    The input string to normalize
62	 * @param  [int]     $form     One of the normalization forms
63	 * @return boolean             True if normalized, false otherwise or if there is an error
64	*/
65	public static function isNormalized($input, $form = Normalizer::FORM_C) {}
66
67}
68
69#############################################################################
70# Procedural API
71#############################################################################
72
73	/**
74	 * Normalizes the input provided and returns the normalized string
75	 * @param  string    $input    The input string to normalize
76	 * @param  [int]     $form     One of the normalization forms
77	 * @return string              The normalized string or null if an error occurred.
78	*/
79	function normalizer_normalize($input, $form = Normalizer::FORM_C) {}
80
81	/**
82	 * Checks if the provided string is already in the specified normalization form.
83	 * @param  string    $input    The input string to normalize
84	 * @param  [int]     $form     One of the normalization forms
85	 * @return boolean             True if normalized, false otherwise or if there an error
86	*/
87	function normalizer_is_normalized($input, $form = Normalizer::FORM_C) {}
88
89
90?>
91