/mvc/components/inflector
[return to app]1
<?php
2 /**
3 * Pluralize and singularize English words.
4 *
5 * This is CakePHP's inflector class updated to PHP5 syntax for Vork
6 *
7 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
8 * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
9 *
10 * Licensed under The MIT License
11 * Redistributions of files must retain the above copyright notice.
12 *
13 * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
14 * @link http://cakephp.org CakePHP(tm) Project
15 * @package cake
16 * @subpackage cake.cake.libs
17 * @since CakePHP(tm) v 0.2.9
18 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
19 */
20
21 /**
22 * Pluralize and singularize English words.
23 *
24 * inflectorComponent pluralizes and singularizes English nouns.
25 * Used by Cake's naming conventions throughout the framework.
26 *
27 * @package cake
28 * @subpackage cake.cake.libs
29 * @link http://book.cakephp.org/view/1478/Inflector
30 */
31 class inflectorComponent {
32 /**
33 * Plural inflector rules
34 *
35 * @var array
36 * @access protected
37 */
38 protected $_plural = array(
39 'rules' => array(
40 '/(s)tatus$/i' => '\1\2tatuses',
41 '/(quiz)$/i' => '\1zes',
42 '/^(ox)$/i' => '\1\2en',
43 '/([m|l])ouse$/i' => '\1ice',
44 '/(matr|vert|ind)(ix|ex)$/i' => '\1ices',
45 '/(x|ch|ss|sh)$/i' => '\1es',
46 '/([^aeiouy]|qu)y$/i' => '\1ies',
47 '/(hive)$/i' => '\1s',
48 '/(?:([^f])fe|([lr])f)$/i' => '\1\2ves',
49 '/sis$/i' => 'ses',
50 '/([ti])um$/i' => '\1a',
51 '/(p)erson$/i' => '\1eople',
52 '/(m)an$/i' => '\1en',
53 '/(c)hild$/i' => '\1hildren',
54 '/(buffal|tomat)o$/i' => '\1\2oes',
55 '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|vir)us$/i' => '\1i',
56 '/us$/' => 'uses',
57 '/(alias)$/i' => '\1es',
58 '/(ax|cris|test)is$/i' => '\1es',
59 '/s$/' => 's',
60 '/^$/' => '',
61 '/$/' => 's',
62 ),
63 'uninflected' => array(
64 '.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox', '.*sheep', 'people'
65 ),
66 'irregular' => array(
67 'atlas' => 'atlases',
68 'beef' => 'beefs',
69 'brother' => 'brothers',
70 'child' => 'children',
71 'corpus' => 'corpuses',
72 'cow' => 'cows',
73 'ganglion' => 'ganglions',
74 'genie' => 'genies',
75 'genus' => 'genera',
76 'graffito' => 'graffiti',
77 'hoof' => 'hoofs',
78 'loaf' => 'loaves',
79 'man' => 'men',
80 'money' => 'monies',
81 'mongoose' => 'mongooses',
82 'move' => 'moves',
83 'mythos' => 'mythoi',
84 'niche' => 'niches',
85 'numen' => 'numina',
86 'occiput' => 'occiputs',
87 'octopus' => 'octopuses',
88 'opus' => 'opuses',
89 'ox' => 'oxen',
90 'penis' => 'penises',
91 'person' => 'people',
92 'sex' => 'sexes',
93 'soliloquy' => 'soliloquies',
94 'testis' => 'testes',
95 'trilby' => 'trilbys',
96 'turf' => 'turfs'
97 )
98 );
99
100 /**
101 * Singular inflector rules
102 *
103 * @var array
104 * @access protected
105 */
106 protected $_singular = array(
107 'rules' => array(
108 '/(s)tatuses$/i' => '\1\2tatus',
109 '/^(.*)(menu)s$/i' => '\1\2',
110 '/(quiz)zes$/i' => '\\1',
111 '/(matr)ices$/i' => '\1ix',
112 '/(vert|ind)ices$/i' => '\1ex',
113 '/^(ox)en/i' => '\1',
114 '/(alias)(es)*$/i' => '\1',
115 '/(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|viri?)i$/i' => '\1us',
116 '/([ftw]ax)es/i' => '\1',
117 '/(cris|ax|test)es$/i' => '\1is',
118 '/(shoe|slave)s$/i' => '\1',
119 '/(o)es$/i' => '\1',
120 '/ouses$/' => 'ouse',
121 '/([^a])uses$/' => '\1us',
122 '/([m|l])ice$/i' => '\1ouse',
123 '/(x|ch|ss|sh)es$/i' => '\1',
124 '/(m)ovies$/i' => '\1\2ovie',
125 '/(s)eries$/i' => '\1\2eries',
126 '/([^aeiouy]|qu)ies$/i' => '\1y',
127 '/([lr])ves$/i' => '\1f',
128 '/(tive)s$/i' => '\1',
129 '/(hive)s$/i' => '\1',
130 '/(drive)s$/i' => '\1',
131 '/([^fo])ves$/i' => '\1fe',
132 '/(^analy)ses$/i' => '\1sis',
133 '/(analy|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis',
134 '/([ti])a$/i' => '\1um',
135 '/(p)eople$/i' => '\1\2erson',
136 '/(m)en$/i' => '\1an',
137 '/(c)hildren$/i' => '\1\2hild',
138 '/(n)ews$/i' => '\1\2ews',
139 '/eaus$/' => 'eau',
140 '/^(.*us)$/' => '\\1',
141 '/s$/i' => ''
142 ),
143 'uninflected' => array(
144 '.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox', '.*sheep', '.*ss'
145 ),
146 'irregular' => array(
147 'waves' => 'wave'
148 )
149 );
150
151 /**
152 * Words that should not be inflected
153 *
154 * @var array
155 * @access protected
156 */
157 protected $_uninflected = array(
158 'Amoyese', 'bison', 'Borghese', 'bream', 'breeches', 'britches', 'buffalo', 'cantus',
159 'carp', 'chassis', 'clippers', 'cod', 'coitus', 'Congoese', 'contretemps', 'corps',
160 'debris', 'diabetes', 'djinn', 'eland', 'elk', 'equipment', 'Faroese', 'flounder',
161 'Foochowese', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'graffiti',
162 'headquarters', 'herpes', 'hijinks', 'Hottentotese', 'information', 'innings',
163 'jackanapes', 'Kiplingese', 'Kongoese', 'Lucchese', 'mackerel', 'Maltese', 'media',
164 'mews', 'moose', 'mumps', 'Nankingese', 'news', 'nexus', 'Niasese',
165 'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'pliers', 'Portuguese',
166 'proceedings', 'rabies', 'rice', 'rhinoceros', 'salmon', 'Sarawakese', 'scissors',
167 'sea[- ]bass', 'series', 'Shavese', 'shears', 'siemens', 'species', 'swine', 'testes',
168 'trousers', 'trout','tuna', 'Vermontese', 'Wenchowese', 'whiting', 'wildebeest',
169 'Yengeese'
170 );
171
172 /**
173 * Default map of accented and special characters to ASCII characters
174 *
175 * @var array
176 * @access protected
177 */
178 protected $_transliteration = array(
179 '/ä|æ|ǽ/' => 'ae',
180 '/ö|Å/' => 'oe',
181 '/ü/' => 'ue',
182 '/Ã/' => 'Ae',
183 '/Ã/' => 'Ue',
184 '/Ã/' => 'Oe',
185 '/Ã|Ã?|Ã|Ã|Ã|Ã
|Ǻ|Ä|Ä|Ä|Ç?/' => 'A',
186 '/à |á|â|ã|Ã¥|Ç»|Ä?|Ä|Ä
|Ç|ª/' => 'a',
187 '/Ã|Ä|Ä|Ä|Ä/' => 'C',
188 '/ç|Ä|Ä|Ä|Ä?/' => 'c',
189 '/Ã?|Ä|Ä?/' => 'D',
190 '/ð|Ä?|Ä/' => 'd',
191 '/Ã|Ã|Ã|Ã|Ä|Ä|Ä|Ä|Ä/' => 'E',
192 '/è|é|ê|ë|Ä|Ä|Ä|Ä|Ä/' => 'e',
193 '/Ä|Ä|Ä |Ä¢/' => 'G',
194 '/Ä?|Ä|Ä¡|Ä£/' => 'g',
195 '/Ĥ|Ħ/' => 'H',
196 '/ĥ|ħ/' => 'h',
197 '/Ã|Ã?|Ã|Ã?|Ĩ|Ī|Ĭ|Ç?|Ä®|Ä°/' => 'I',
198 '/ì|Ã|î|ï|Ä©|Ä«|Ä|Ç?|į|ı/' => 'i',
199 '/Ä´/' => 'J',
200 '/ĵ/' => 'j',
201 '/Ķ/' => 'K',
202 '/Ä·/' => 'k',
203 '/Ĺ|Ä»|Ľ|Ä¿|Å?/' => 'L',
204 '/ĺ|ļ|ľ|Å|Å/' => 'l',
205 '/Ã|Å|Å
|Å/' => 'N',
206 '/ñ|Å|Å|Å|Å/' => 'n',
207 '/Ã|Ã|Ã|Ã|Å|Å|Ç|Å?|Æ |Ã|Ǿ/' => 'O',
208 '/ò|ó|ô|õ|Å?|Å?|Ç|Å|Æ¡|ø|Ç¿|º/' => 'o',
209 '/Å|Å|Å/' => 'R',
210 '/Å|Å|Å/' => 'r',
211 '/Å|Å|Å|Å /' => 'S',
212 '/Å|Å?|Å|Å¡|Å¿/' => 's',
213 '/Ţ|Ť|Ŧ/' => 'T',
214 '/ţ|ť|ŧ/' => 't',
215 '/Ã|Ã|Ã|Ũ|Ū|Ŭ|Å®|Å°|Ų|Ư|Ç|Ç|Ç|Ç|Ç/' => 'U',
216 '/ù|ú|û|Å©|Å«|Å|ů|ű|ų|Æ°|Ç|Ç|Ç|Ç|Ç/' => 'u',
217 '/�|Ÿ|Ŷ/' => 'Y',
218 '/ý|ÿ|ŷ/' => 'y',
219 '/Å´/' => 'W',
220 '/ŵ/' => 'w',
221 '/Ź|Ż|Ž/' => 'Z',
222 '/ź|ż|ž/' => 'z',
223 '/Ã|Ǽ/' => 'AE',
224 '/Ã/'=> 'ss',
225 '/IJ/' => 'IJ',
226 '/ij/' => 'ij',
227 '/Å/' => 'OE',
228 '/Æ/' => 'f'
229 );
230
231 /**
232 * Cached array identity map of pluralized words.
233 *
234 * @var array
235 * @access protected
236 */
237 protected $_pluralized = array();
238
239 /**
240 * Cached array identity map of singularized words.
241 *
242 * @var array
243 * @access protected
244 */
245 protected $_singularized = array();
246
247 /**
248 * Cached Underscore Inflections
249 *
250 * @var array
251 * @access protected
252 */
253 protected $_underscore = array();
254
255 /**
256 * Cached Camelize Inflections
257 *
258 * @var array
259 * @access protected
260 */
261 protected $_camelize = array();
262
263 /**
264 * Classify cached inflecctions
265 *
266 * @var array
267 * @access protected
268 */
269 protected $_classify = array();
270
271 /**
272 * Tablize cached inflections
273 *
274 * @var array
275 * @access protected
276 */
277 protected $_tableize = array();
278
279 /**
280 * Humanize cached inflections
281 *
282 * @var array
283 * @access protected
284 */
285 protected $_humanize = array();
286
287 /**
288 * Gets a reference to the inflectorComponent object instance
289 *
290 * @return object
291 * @access public
292 */
293 public function &getInstance() {
294 static $instance = array();
295
296 if (!$instance) {
297 $instance[0] = new inflectorComponent();
298 }
299 return $instance[0];
300 }
301
302 /**
303 * Cache inflected values, and return if already available
304 *
305 * @param string $type Inflection type
306 * @param string $key Original value
307 * @param string $value Inflected value
308 * @return string Inflected value, from cache
309 * @access protected
310 */
311 protected function _cache($type, $key, $value = false) {
312 $key = '_' . $key;
313 $type = '_' . $type;
314 if ($value !== false) {
315 $this->{$type}[$key] = $value;
316 return $value;
317 }
318
319 if (!isset($this->{$type}[$key])) {
320 return false;
321 }
322 return $this->{$type}[$key];
323 }
324
325 /**
326 * Adds custom inflection $rules, of either 'plural', 'singular' or 'transliteration' $type.
327 *
328 * ### Usage:
329 *
330 * {{{
331 * inflectorComponent::rules('plural', array('/^(inflect)or$/i' => '\1ables'));
332 * inflectorComponent::rules('plural', array(
333 * 'rules' => array('/^(inflect)ors$/i' => '\1ables'),
334 * 'uninflected' => array('dontinflectme'),
335 * 'irregular' => array('red' => 'redlings')
336 * ));
337 * inflectorComponent::rules('transliteration', array('/Ã¥/' => 'aa'));
338 * }}}
339 *
340 * @param string $type The type of inflection, either 'plural', 'singular' or 'transliteration'
341 * @param array $rules Array of rules to be added.
342 * @param boolean $reset If true, will unset default inflections for all
343 * new rules that are being defined in $rules.
344 * @access public
345 * @return void
346 * @static
347 */
348 public function rules($type, $rules, $reset = false) {
349 $_this =& inflectorComponent::getInstance();
350 $var = '_'.$type;
351
352 switch ($type) {
353 case 'transliteration':
354 if ($reset) {
355 $_this->_transliteration = $rules;
356 } else {
357 $_this->_transliteration = $rules + $_this->_transliteration;
358 }
359 break;
360
361 default:
362 foreach ($rules as $rule => $pattern) {
363 if (is_array($pattern)) {
364 if ($reset) {
365 $_this->{$var}[$rule] = $pattern;
366 } else {
367 $_this->{$var}[$rule] = array_merge($pattern, $_this->{$var}[$rule]);
368 }
369 unset($rules[$rule], $_this->{$var}['cache' . ucfirst($rule)]);
370 if (isset($_this->{$var}['merged'][$rule])) {
371 unset($_this->{$var}['merged'][$rule]);
372 }
373 if ($type === 'plural') {
374 $_this->_pluralized = $_this->_tableize = array();
375 } elseif ($type === 'singular') {
376 $_this->_singularized = array();
377 }
378 }
379 }
380 $_this->{$var}['rules'] = array_merge($rules, $_this->{$var}['rules']);
381 break;
382 }
383 }
384
385 /**
386 * Return $word in plural form.
387 *
388 * @param string $word Word in singular
389 * @return string Word in plural
390 * @access public
391 * @static
392 * @link http://book.cakephp.org/view/1479/Class-methods
393 */
394 public function pluralize($word) {
395 $_this =& inflectorComponent::getInstance();
396
397 if (isset($_this->_pluralized[$word])) {
398 return $_this->_pluralized[$word];
399 }
400
401 if (!isset($_this->_plural['merged']['irregular'])) {
402 $_this->_plural['merged']['irregular'] = $_this->_plural['irregular'];
403 }
404
405 if (!isset($_this->plural['merged']['uninflected'])) {
406 $_this->_plural['merged']['uninflected'] = array_merge($_this->_plural['uninflected'], $_this->_uninflected);
407 }
408
409 if (!isset($_this->_plural['cacheUninflected']) || !isset($_this->_plural['cacheIrregular'])) {
410 $_this->_plural['cacheUninflected'] = '(?:' . implode('|', $_this->_plural['merged']['uninflected']) . ')';
411 $_this->_plural['cacheIrregular'] = '(?:' . implode('|', array_keys($_this->_plural['merged']['irregular'])) .
')';
412 }
413
414 if (preg_match('/(.*)\\b(' . $_this->_plural['cacheIrregular'] . ')$/i', $word, $regs)) {
415 $_this->_pluralized[$word] = $regs[1] . substr($word, 0, 1) .
substr($_this->_plural['merged']['irregular'][strtolower($regs[2])], 1);
416 return $_this->_pluralized[$word];
417 }
418
419 if (preg_match('/^(' . $_this->_plural['cacheUninflected'] . ')$/i', $word, $regs)) {
420 $_this->_pluralized[$word] = $word;
421 return $word;
422 }
423
424 foreach ($_this->_plural['rules'] as $rule => $replacement) {
425 if (preg_match($rule, $word)) {
426 $_this->_pluralized[$word] = preg_replace($rule, $replacement, $word);
427 return $_this->_pluralized[$word];
428 }
429 }
430 }
431
432 /**
433 * Return $word in singular form.
434 *
435 * @param string $word Word in plural
436 * @return string Word in singular
437 * @access public
438 * @static
439 * @link http://book.cakephp.org/view/1479/Class-methods
440 */
441 public function singularize($word) {
442 $_this =& inflectorComponent::getInstance();
443
444 if (isset($_this->_singularized[$word])) {
445 return $_this->_singularized[$word];
446 }
447
448 if (!isset($_this->_singular['merged']['uninflected'])) {
449 $_this->_singular['merged']['uninflected'] = array_merge($_this->_singular['uninflected'],
$_this->_uninflected);
450 }
451
452 if (!isset($_this->_singular['merged']['irregular'])) {
453 $_this->_singular['merged']['irregular'] = array_merge($_this->_singular['irregular'],
array_flip($_this->_plural['irregular']));
454 }
455
456 if (!isset($_this->_singular['cacheUninflected']) || !isset($_this->_singular['cacheIrregular'])) {
457 $_this->_singular['cacheUninflected'] = '(?:' . join( '|', $_this->_singular['merged']['uninflected']) . ')';
458 $_this->_singular['cacheIrregular'] = '(?:' . join( '|', array_keys($_this->_singular['merged']['irregular']))
. ')';
459 }
460
461 if (preg_match('/(.*)\\b(' . $_this->_singular['cacheIrregular'] . ')$/i', $word, $regs)) {
462 $_this->_singularized[$word] = $regs[1] . substr($word, 0, 1) .
substr($_this->_singular['merged']['irregular'][strtolower($regs[2])], 1);
463 return $_this->_singularized[$word];
464 }
465
466 if (preg_match('/^(' . $_this->_singular['cacheUninflected'] . ')$/i', $word, $regs)) {
467 $_this->_singularized[$word] = $word;
468 return $word;
469 }
470
471 foreach ($_this->_singular['rules'] as $rule => $replacement) {
472 if (preg_match($rule, $word)) {
473 $_this->_singularized[$word] = preg_replace($rule, $replacement, $word);
474 return $_this->_singularized[$word];
475 }
476 }
477 $_this->_singularized[$word] = $word;
478 return $word;
479 }
480
481 /**
482 * Returns the given lower_case_and_underscored_word as a CamelCased word.
483 *
484 * @param string $lower_case_and_underscored_word Word to camelize
485 * @return string Camelized word. LikeThis.
486 * @access public
487 * @static
488 * @link http://book.cakephp.org/view/1479/Class-methods
489 */
490 public function camelize($lowerCaseAndUnderscoredWord) {
491 $_this =& inflectorComponent::getInstance();
492 if (!($result = $_this->_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord))) {
493 $result = str_replace(' ', '', inflectorComponent::humanize($lowerCaseAndUnderscoredWord));
494 $_this->_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord, $result);
495 }
496 return $result;
497 }
498
499 /**
500 * Returns the given camelCasedWord as an underscored_word.
501 *
502 * @param string $camelCasedWord Camel-cased word to be "underscorized"
503 * @return string Underscore-syntaxed version of the $camelCasedWord
504 * @access public
505 * @static
506 * @link http://book.cakephp.org/view/1479/Class-methods
507 */
508 public function underscore($camelCasedWord) {
509 $_this =& inflectorComponent::getInstance();
510 if (!($result = $_this->_cache(__FUNCTION__, $camelCasedWord))) {
511 $result = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $camelCasedWord));
512 $_this->_cache(__FUNCTION__, $camelCasedWord, $result);
513 }
514 return $result;
515 }
516
517 /**
518 * Returns the given underscored_word_group as a Human Readable Word Group.
519 * (Underscores are replaced by spaces and capitalized following words.)
520 *
521 * @param string $lower_case_and_underscored_word String to be made more readable
522 * @return string Human-readable string
523 * @access public
524 * @static
525 * @link http://book.cakephp.org/view/1479/Class-methods
526 */
527 public function humanize($lowerCaseAndUnderscoredWord) {
528 $_this =& inflectorComponent::getInstance();
529 if (!($result = $_this->_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord))) {
530 $result = ucwords(str_replace('_', ' ', $lowerCaseAndUnderscoredWord));
531 $_this->_cache(__FUNCTION__, $lowerCaseAndUnderscoredWord, $result);
532 }
533 return $result;
534 }
535
536 /**
537 * Returns corresponding table name for given model $className. ("people" for the model class "Person").
538 *
539 * @param string $className Name of class to get database table name for
540 * @return string Name of the database table for given class
541 * @access public
542 * @static
543 * @link http://book.cakephp.org/view/1479/Class-methods
544 */
545 public function tableize($className) {
546 $_this =& inflectorComponent::getInstance();
547 if (!($result = $_this->_cache(__FUNCTION__, $className))) {
548 $result = inflectorComponent::pluralize(inflectorComponent::underscore($className));
549 $_this->_cache(__FUNCTION__, $className, $result);
550 }
551 return $result;
552 }
553
554 /**
555 * Returns Cake model class name ("Person" for the database table "people".) for given database table.
556 *
557 * @param string $tableName Name of database table to get class name for
558 * @return string Class name
559 * @access public
560 * @static
561 * @link http://book.cakephp.org/view/1479/Class-methods
562 */
563 public function classify($tableName) {
564 $_this =& inflectorComponent::getInstance();
565 if (!($result = $_this->_cache(__FUNCTION__, $tableName))) {
566 $result = inflectorComponent::camelize(inflectorComponent::singularize($tableName));
567 $_this->_cache(__FUNCTION__, $tableName, $result);
568 }
569 return $result;
570 }
571
572 /**
573 * Returns camelBacked version of an underscored string.
574 *
575 * @param string $string
576 * @return string in variable form
577 * @access public
578 * @static
579 * @link http://book.cakephp.org/view/1479/Class-methods
580 */
581 public function variable($string) {
582 $_this =& inflectorComponent::getInstance();
583 if (!($result = $_this->_cache(__FUNCTION__, $string))) {
584 $string2 = inflectorComponent::camelize(inflectorComponent::underscore($string));
585 $replace = strtolower(substr($string2, 0, 1));
586 $result = preg_replace('/\\w/', $replace, $string2, 1);
587 $_this->_cache(__FUNCTION__, $string, $result);
588 }
589 return $result;
590 }
591
592 /**
593 * Returns a string with all spaces converted to underscores (by default), accented
594 * characters converted to non-accented characters, and non word characters removed.
595 *
596 * @param string $string the string you want to slug
597 * @param string $replacement will replace keys in map
598 * @param array $map extra elements to map to the replacement
599 * @deprecated $map param will be removed in future versions. Use inflectorComponent::rules() instead
600 * @return string
601 * @access public
602 * @static
603 * @link http://book.cakephp.org/view/1479/Class-methods
604 */
605 public function slug($string, $replacement = '_', $map = array()) {
606 $_this =& inflectorComponent::getInstance();
607
608 if (is_array($replacement)) {
609 $map = $replacement;
610 $replacement = '_';
611 }
612 $quotedReplacement = preg_quote($replacement, '/');
613
614 $merge = array(
615 '/[^\s\p{Ll}\p{Lm}\p{Lo}\p{Lt}\p{Lu}\p{Nd}]/mu' => ' ',
616 '/\\s+/' => $replacement,
617 sprintf('/^[%s]+|[%s]+$/', $quotedReplacement, $quotedReplacement) => '',
618 );
619
620 $map = $map + $_this->_transliteration + $merge;
621 return preg_replace(array_keys($map), array_values($map), $string);
622 }
623 }