Completed
Pull Request — master (#8)
by Martijn van
02:26
created

Str::replaceLast()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 10
Ratio 100 %

Importance

Changes 3
Bugs 1 Features 0
Metric Value
c 3
b 1
f 0
dl 10
loc 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 3
1
<?php
2
3
/**
4
 * Class Str.
5
 *
6
 * Shameless copy/paste from Taylor Otwell's Laravel
7
 */
8
class Str
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
9
{
10
    /**
11
     * The cache of snake-cased words.
12
     *
13
     * @var array
14
     */
15
    protected static $snakeCache = [];
16
17
    /**
18
     * The cache of camel-cased words.
19
     *
20
     * @var array
21
     */
22
    protected static $camelCache = [];
23
24
    /**
25
     * The cache of studly-cased words.
26
     *
27
     * @var array
28
     */
29
    protected static $studlyCache = [];
30
31
    /**
32
     * Transliterate a UTF-8 value to ASCII.
33
     *
34
     * @param string $value
35
     *
36
     * @return string
37
     */
38
    public static function ascii($value)
39
    {
40
        foreach (static::charsArray() as $key => $val) {
41
            $value = str_replace($val, $key, $value);
42
        }
43
44
        return preg_replace('/[^\x20-\x7E]/u', '', $value);
45
    }
46
47
    /**
48
     * Convert a value to camel case.
49
     *
50
     * @param string $value
51
     *
52
     * @return string
53
     */
54
    public static function camel($value)
55
    {
56
        if (isset(static::$camelCache[$value])) {
57
            return static::$camelCache[$value];
58
        }
59
60
        return static::$camelCache[$value] = lcfirst(static::studly($value));
61
    }
62
63
    /**
64
     * Determine if a given string contains a given substring.
65
     *
66
     * @param string       $haystack
67
     * @param string|array $needles
68
     *
69
     * @return bool
70
     */
71 View Code Duplication
    public static function contains($haystack, $needles)
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
72
    {
73
        foreach ((array) $needles as $needle) {
74
            if ($needle != '' && strpos($haystack, $needle) !== false) {
75
                return true;
76
            }
77
        }
78
79
        return false;
80
    }
81
82
    /**
83
     * Determine if a given string ends with a given substring.
84
     *
85
     * @param string       $haystack
86
     * @param string|array $needles
87
     *
88
     * @return bool
89
     */
90 View Code Duplication
    public static function endsWith($haystack, $needles)
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
91
    {
92
        foreach ((array) $needles as $needle) {
93
            if ((string) $needle === substr($haystack, -strlen($needle))) {
94
                return true;
95
            }
96
        }
97
98
        return false;
99
    }
100
101
    /**
102
     * Cap a string with a single instance of a given value.
103
     *
104
     * @param string $value
105
     * @param string $cap
106
     *
107
     * @return string
108
     */
109
    public static function finish($value, $cap)
110
    {
111
        $quoted = preg_quote($cap, '/');
112
113
        return preg_replace('/(?:'.$quoted.')+$/', '', $value).$cap;
114
    }
115
116
    /**
117
     * Determine if a given string matches a given pattern.
118
     *
119
     * @param string $pattern
120
     * @param string $value
121
     *
122
     * @return bool
123
     */
124
    public static function is($pattern, $value)
125
    {
126
        if ($pattern == $value) {
127
            return true;
128
        }
129
130
        $pattern = preg_quote($pattern, '#');
131
132
        // Asterisks are translated into zero-or-more regular expression wildcards
133
        // to make it convenient to check if the strings starts with the given
134
        // pattern such as "library/*", making any string check convenient.
135
        $pattern = str_replace('\*', '.*', $pattern);
136
137
        return (bool) preg_match('#^'.$pattern.'\z#', $value);
138
    }
139
140
    /**
141
     * Return the length of the given string.
142
     *
143
     * @param string $value
144
     *
145
     * @return int
146
     */
147
    public static function length($value)
148
    {
149
        return mb_strlen($value);
150
    }
151
152
    /**
153
     * Limit the number of characters in a string.
154
     *
155
     * @param string $value
156
     * @param int    $limit
157
     * @param string $end
158
     *
159
     * @return string
160
     */
161
    public static function limit($value, $limit = 100, $end = '...')
162
    {
163
        if (mb_strwidth($value, 'UTF-8') <= $limit) {
164
            return $value;
165
        }
166
167
        return rtrim(mb_strimwidth($value, 0, $limit, '', 'UTF-8')).$end;
168
    }
169
170
    /**
171
     * Convert the given string to lower-case.
172
     *
173
     * @param string $value
174
     *
175
     * @return string
176
     */
177
    public static function lower($value)
178
    {
179
        return mb_strtolower($value, 'UTF-8');
180
    }
181
182
    /**
183
     * Limit the number of words in a string.
184
     *
185
     * @param string $value
186
     * @param int    $words
187
     * @param string $end
188
     *
189
     * @return string
190
     */
191
    public static function words($value, $words = 100, $end = '...')
192
    {
193
        preg_match('/^\s*+(?:\S++\s*+){1,'.$words.'}/u', $value, $matches);
194
195
        if (!isset($matches[0]) || strlen($value) === strlen($matches[0])) {
196
            return $value;
197
        }
198
199
        return rtrim($matches[0]).$end;
200
    }
201
202
    /**
203
     * Parse a Class@method style callback into class and method.
204
     *
205
     * @param string $callback
206
     * @param string $default
207
     *
208
     * @return array
209
     */
210
    public static function parseCallback($callback, $default)
211
    {
212
        return static::contains($callback, '@') ? explode('@', $callback, 2) : [$callback, $default];
213
    }
214
215
    /**
216
     * Generate a more truly "random" alpha-numeric string.
217
     *
218
     * @param int $length
219
     *
220
     * @throws \RuntimeException
221
     *
222
     * @return string
223
     */
224
    public static function random($length = 16)
225
    {
226
        $string = '';
227
228
        while (($len = strlen($string)) < $length) {
229
            $size = $length - $len;
230
231
            $bytes = random_bytes($size);
232
233
            $string .= substr(str_replace(['/', '+', '='], '', base64_encode($bytes)), 0, $size);
234
        }
235
236
        return $string;
237
    }
238
239
    /**
240
     * Generate a more truly "random" bytes.
241
     *
242
     * @param int $length
243
     *
244
     * @throws \RuntimeException
245
     *
246
     * @return string
247
     *
248
     * @deprecated since version 5.2. Use random_bytes instead.
249
     */
250
    public static function randomBytes($length = 16)
251
    {
252
        if (PHP_MAJOR_VERSION >= 7 || defined('RANDOM_COMPAT_READ_BUFFER')) {
253
            $bytes = random_bytes($length);
254
        } elseif (function_exists('openssl_random_pseudo_bytes')) {
255
            $bytes = openssl_random_pseudo_bytes($length, $strong);
256
257
            if ($bytes === false || $strong === false) {
258
                throw new RuntimeException('Unable to generate random string.');
259
            }
260
        } else {
261
            throw new RuntimeException('OpenSSL extension or paragonie/random_compat is required for PHP 5 users.');
262
        }
263
264
        return $bytes;
265
    }
266
267
    /**
268
     * Generate a "random" alpha-numeric string.
269
     *
270
     * Should not be considered sufficient for cryptography, etc.
271
     *
272
     * @param int $length
273
     *
274
     * @return string
275
     */
276
    public static function quickRandom($length = 16)
277
    {
278
        $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
279
280
        return substr(str_shuffle(str_repeat($pool, $length)), 0, $length);
281
    }
282
283
    /**
284
     * Compares two strings using a constant-time algorithm.
285
     *
286
     * Note: This method will leak length information.
287
     *
288
     * Note: Adapted from Symfony\Component\Security\Core\Util\StringUtils.
289
     *
290
     * @param string $knownString
291
     * @param string $userInput
292
     *
293
     * @return bool
294
     *
295
     * @deprecated since version 5.2. Use hash_equals instead.
296
     */
297
    public static function equals($knownString, $userInput)
298
    {
299
        return hash_equals($knownString, $userInput);
300
    }
301
302
    /**
303
     * Replace the first occurrence of a given value in the string.
304
     *
305
     * @param string $search
306
     * @param string $replace
307
     * @param string $subject
308
     *
309
     * @return string
310
     */
311 View Code Duplication
    public static function replaceFirst($search, $replace, $subject)
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
312
    {
313
        $position = strpos($subject, $search);
314
315
        if ($position !== false) {
316
            return substr_replace($subject, $replace, $position, strlen($search));
317
        }
318
319
        return $subject;
320
    }
321
322
    /**
323
     * Replace the last occurrence of a given value in the string.
324
     *
325
     * @param string $search
326
     * @param string $replace
327
     * @param string $subject
328
     *
329
     * @return string
330
     */
331 View Code Duplication
    public static function replaceLast($search, $replace, $subject)
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
332
    {
333
        $position = strrpos($subject, $search);
334
335
        if ($position !== false) {
336
            return substr_replace($subject, $replace, $position, strlen($search));
337
        }
338
339
        return $subject;
340
    }
341
342
    /**
343
     * Convert the given string to upper-case.
344
     *
345
     * @param string $value
346
     *
347
     * @return string
348
     */
349
    public static function upper($value)
350
    {
351
        return mb_strtoupper($value, 'UTF-8');
352
    }
353
354
    /**
355
     * Convert the given string to title case.
356
     *
357
     * @param string $value
358
     *
359
     * @return string
360
     */
361
    public static function title($value)
362
    {
363
        return mb_convert_case($value, MB_CASE_TITLE, 'UTF-8');
364
    }
365
366
    /**
367
     * Generate a URL friendly "slug" from a given string.
368
     *
369
     * @param string $title
370
     * @param string $separator
371
     *
372
     * @return string
373
     */
374
    public static function slug($title, $separator = '-')
375
    {
376
        $title = static::ascii($title);
377
378
        // Convert all dashes/underscores into separator
379
        $flip = $separator == '-' ? '_' : '-';
380
381
        $title = preg_replace('!['.preg_quote($flip).']+!u', $separator, $title);
382
383
        // Remove all characters that are not the separator, letters, numbers, or whitespace.
384
        $title = preg_replace('![^'.preg_quote($separator).'\pL\pN\s]+!u', '', mb_strtolower($title));
385
386
        // Replace all separator characters and whitespace by a single separator
387
        $title = preg_replace('!['.preg_quote($separator).'\s]+!u', $separator, $title);
388
389
        return trim($title, $separator);
390
    }
391
392
    /**
393
     * Convert a string to snake case.
394
     *
395
     * @param string $value
396
     * @param string $delimiter
397
     *
398
     * @return string
399
     */
400
    public static function snake($value, $delimiter = '_')
401
    {
402
        $key = $value.$delimiter;
403
404
        if (isset(static::$snakeCache[$key])) {
405
            return static::$snakeCache[$key];
406
        }
407
408
        if (!ctype_lower($value)) {
409
            $value = preg_replace('/\s+/', '', $value);
410
411
            $value = strtolower(preg_replace('/(.)(?=[A-Z])/', '$1'.$delimiter, $value));
412
        }
413
414
        return static::$snakeCache[$key] = $value;
415
    }
416
417
    /**
418
     * Determine if a given string starts with a given substring.
419
     *
420
     * @param string       $haystack
421
     * @param string|array $needles
422
     *
423
     * @return bool
424
     */
425 View Code Duplication
    public static function startsWith($haystack, $needles)
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
426
    {
427
        foreach ((array) $needles as $needle) {
428
            if ($needle != '' && strpos($haystack, $needle) === 0) {
429
                return true;
430
            }
431
        }
432
433
        return false;
434
    }
435
436
    /**
437
     * Convert a value to studly caps case.
438
     *
439
     * @param string $value
440
     *
441
     * @return string
442
     */
443
    public static function studly($value)
444
    {
445
        $key = $value;
446
447
        if (isset(static::$studlyCache[$key])) {
448
            return static::$studlyCache[$key];
449
        }
450
451
        $value = ucwords(str_replace(['-', '_'], ' ', $value));
452
453
        return static::$studlyCache[$key] = str_replace(' ', '', $value);
454
    }
455
456
    /**
457
     * Returns the portion of string specified by the start and length parameters.
458
     *
459
     * @param string   $string
460
     * @param int      $start
461
     * @param int|null $length
462
     *
463
     * @return string
464
     */
465
    public static function substr($string, $start, $length = null)
466
    {
467
        return mb_substr($string, $start, $length, 'UTF-8');
468
    }
469
470
    /**
471
     * Make a string's first character uppercase.
472
     *
473
     * @param string $string
474
     *
475
     * @return string
476
     */
477
    public static function ucfirst($string)
478
    {
479
        return static::upper(static::substr($string, 0, 1)).static::substr($string, 1);
480
    }
481
482
    /**
483
     * Returns the replacements for the ascii method.
484
     *
485
     * Note: Adapted from Stringy\Stringy.
486
     *
487
     * @see https://github.com/danielstjules/Stringy/blob/2.2.0/LICENSE.txt
488
     *
489
     * @return array
490
     */
491
    protected static function charsArray()
492
    {
493
        static $charsArray;
494
495
        if (isset($charsArray)) {
496
            return $charsArray;
497
        }
498
499
        return $charsArray = [
500
            '0'    => ['°', '₀'],
501
            '1'    => ['¹', '₁'],
502
            '2'    => ['²', '₂'],
503
            '3'    => ['³', '₃'],
504
            '4'    => ['⁴', '₄'],
505
            '5'    => ['⁵', '₅'],
506
            '6'    => ['⁶', '₆'],
507
            '7'    => ['⁷', '₇'],
508
            '8'    => ['⁸', '₈'],
509
            '9'    => ['⁹', '₉'],
510
            'a'    => ['à', 'á', 'ả', 'ã', 'ạ', 'ă', 'ắ', 'ằ', 'ẳ', 'ẵ', 'ặ', 'â', 'ấ', 'ầ', 'ẩ', 'ẫ', 'ậ', 'ā', 'ą', 'å', 'α', 'ά', 'ἀ', 'ἁ', 'ἂ', 'ἃ', 'ἄ', 'ἅ', 'ἆ', 'ἇ', 'ᾀ', 'ᾁ', 'ᾂ', 'ᾃ', 'ᾄ', 'ᾅ', 'ᾆ', 'ᾇ', 'ὰ', 'ά', 'ᾰ', 'ᾱ', 'ᾲ', 'ᾳ', 'ᾴ', 'ᾶ', 'ᾷ', 'а', 'أ', 'အ', 'ာ', 'ါ', 'ǻ', 'ǎ', 'ª', 'ა', 'अ'],
511
            'b'    => ['б', 'β', 'Ъ', 'Ь', 'ب', 'ဗ', 'ბ'],
512
            'c'    => ['ç', 'ć', 'č', 'ĉ', 'ċ'],
513
            'd'    => ['ď', 'ð', 'đ', 'ƌ', 'ȡ', 'ɖ', 'ɗ', 'ᵭ', 'ᶁ', 'ᶑ', 'д', 'δ', 'د', 'ض', 'ဍ', 'ဒ', 'დ'],
514
            'e'    => ['é', 'è', 'ẻ', 'ẽ', 'ẹ', 'ê', 'ế', 'ề', 'ể', 'ễ', 'ệ', 'ë', 'ē', 'ę', 'ě', 'ĕ', 'ė', 'ε', 'έ', 'ἐ', 'ἑ', 'ἒ', 'ἓ', 'ἔ', 'ἕ', 'ὲ', 'έ', 'е', 'ё', 'э', 'є', 'ə', 'ဧ', 'ေ', 'ဲ', 'ე', 'ए'],
515
            'f'    => ['ф', 'φ', 'ف', 'ƒ', 'ფ'],
516
            'g'    => ['ĝ', 'ğ', 'ġ', 'ģ', 'г', 'ґ', 'γ', 'ج', 'ဂ', 'გ'],
517
            'h'    => ['ĥ', 'ħ', 'η', 'ή', 'ح', 'ه', 'ဟ', 'ှ', 'ჰ'],
518
            'i'    => ['í', 'ì', 'ỉ', 'ĩ', 'ị', 'î', 'ï', 'ī', 'ĭ', 'į', 'ı', 'ι', 'ί', 'ϊ', 'ΐ', 'ἰ', 'ἱ', 'ἲ', 'ἳ', 'ἴ', 'ἵ', 'ἶ', 'ἷ', 'ὶ', 'ί', 'ῐ', 'ῑ', 'ῒ', 'ΐ', 'ῖ', 'ῗ', 'і', 'ї', 'и', 'ဣ', 'ိ', 'ီ', 'ည်', 'ǐ', 'ი', 'इ'],
519
            'j'    => ['ĵ', 'ј', 'Ј', 'ჯ'],
520
            'k'    => ['ķ', 'ĸ', 'к', 'κ', 'Ķ', 'ق', 'ك', 'က', 'კ', 'ქ'],
521
            'l'    => ['ł', 'ľ', 'ĺ', 'ļ', 'ŀ', 'л', 'λ', 'ل', 'လ', 'ლ'],
522
            'm'    => ['м', 'μ', 'م', 'မ', 'მ'],
523
            'n'    => ['ñ', 'ń', 'ň', 'ņ', 'ʼn', 'ŋ', 'ν', 'н', 'ن', 'န', 'ნ'],
524
            'o'    => ['ó', 'ò', 'ỏ', 'õ', 'ọ', 'ô', 'ố', 'ồ', 'ổ', 'ỗ', 'ộ', 'ơ', 'ớ', 'ờ', 'ở', 'ỡ', 'ợ', 'ø', 'ō', 'ő', 'ŏ', 'ο', 'ὀ', 'ὁ', 'ὂ', 'ὃ', 'ὄ', 'ὅ', 'ὸ', 'ό', 'о', 'و', 'θ', 'ို', 'ǒ', 'ǿ', 'º', 'ო', 'ओ'],
525
            'p'    => ['п', 'π', 'ပ', 'პ'],
526
            'q'    => ['ყ'],
527
            'r'    => ['ŕ', 'ř', 'ŗ', 'р', 'ρ', 'ر', 'რ'],
528
            's'    => ['ś', 'š', 'ş', 'с', 'σ', 'ș', 'ς', 'س', 'ص', 'စ', 'ſ', 'ს'],
529
            't'    => ['ť', 'ţ', 'т', 'τ', 'ț', 'ت', 'ط', 'ဋ', 'တ', 'ŧ', 'თ', 'ტ'],
530
            'u'    => ['ú', 'ù', 'ủ', 'ũ', 'ụ', 'ư', 'ứ', 'ừ', 'ử', 'ữ', 'ự', 'û', 'ū', 'ů', 'ű', 'ŭ', 'ų', 'µ', 'у', 'ဉ', 'ု', 'ူ', 'ǔ', 'ǖ', 'ǘ', 'ǚ', 'ǜ', 'უ', 'उ'],
531
            'v'    => ['в', 'ვ', 'ϐ'],
532
            'w'    => ['ŵ', 'ω', 'ώ', 'ဝ', 'ွ'],
533
            'x'    => ['χ', 'ξ'],
534
            'y'    => ['ý', 'ỳ', 'ỷ', 'ỹ', 'ỵ', 'ÿ', 'ŷ', 'й', 'ы', 'υ', 'ϋ', 'ύ', 'ΰ', 'ي', 'ယ'],
535
            'z'    => ['ź', 'ž', 'ż', 'з', 'ζ', 'ز', 'ဇ', 'ზ'],
536
            'aa'   => ['ع', 'आ'],
537
            'ae'   => ['ä', 'æ', 'ǽ'],
538
            'ai'   => ['ऐ'],
539
            'at'   => ['@'],
540
            'ch'   => ['ч', 'ჩ', 'ჭ'],
541
            'dj'   => ['ђ', 'đ'],
542
            'dz'   => ['џ', 'ძ'],
543
            'ei'   => ['ऍ'],
544
            'gh'   => ['غ', 'ღ'],
545
            'ii'   => ['ई'],
546
            'ij'   => ['ij'],
547
            'kh'   => ['х', 'خ', 'ხ'],
548
            'lj'   => ['љ'],
549
            'nj'   => ['њ'],
550
            'oe'   => ['ö', 'œ'],
551
            'oi'   => ['ऑ'],
552
            'oii'  => ['ऒ'],
553
            'ps'   => ['ψ'],
554
            'sh'   => ['ш', 'შ'],
555
            'shch' => ['щ'],
556
            'ss'   => ['ß'],
557
            'sx'   => ['ŝ'],
558
            'th'   => ['þ', 'ϑ', 'ث', 'ذ', 'ظ'],
559
            'ts'   => ['ц', 'ც', 'წ'],
560
            'ue'   => ['ü'],
561
            'uu'   => ['ऊ'],
562
            'ya'   => ['я'],
563
            'yu'   => ['ю'],
564
            'zh'   => ['ж', 'ჟ'],
565
            '(c)'  => ['©'],
566
            'A'    => ['Á', 'À', 'Ả', 'Ã', 'Ạ', 'Ă', 'Ắ', 'Ằ', 'Ẳ', 'Ẵ', 'Ặ', 'Â', 'Ấ', 'Ầ', 'Ẩ', 'Ẫ', 'Ậ', 'Å', 'Ā', 'Ą', 'Α', 'Ά', 'Ἀ', 'Ἁ', 'Ἂ', 'Ἃ', 'Ἄ', 'Ἅ', 'Ἆ', 'Ἇ', 'ᾈ', 'ᾉ', 'ᾊ', 'ᾋ', 'ᾌ', 'ᾍ', 'ᾎ', 'ᾏ', 'Ᾰ', 'Ᾱ', 'Ὰ', 'Ά', 'ᾼ', 'А', 'Ǻ', 'Ǎ'],
567
            'B'    => ['Б', 'Β', 'ब'],
568
            'C'    => ['Ç', 'Ć', 'Č', 'Ĉ', 'Ċ'],
569
            'D'    => ['Ď', 'Ð', 'Đ', 'Ɖ', 'Ɗ', 'Ƌ', 'ᴅ', 'ᴆ', 'Д', 'Δ'],
570
            'E'    => ['É', 'È', 'Ẻ', 'Ẽ', 'Ẹ', 'Ê', 'Ế', 'Ề', 'Ể', 'Ễ', 'Ệ', 'Ë', 'Ē', 'Ę', 'Ě', 'Ĕ', 'Ė', 'Ε', 'Έ', 'Ἐ', 'Ἑ', 'Ἒ', 'Ἓ', 'Ἔ', 'Ἕ', 'Έ', 'Ὲ', 'Е', 'Ё', 'Э', 'Є', 'Ə'],
571
            'F'    => ['Ф', 'Φ'],
572
            'G'    => ['Ğ', 'Ġ', 'Ģ', 'Г', 'Ґ', 'Γ'],
573
            'H'    => ['Η', 'Ή', 'Ħ'],
574
            'I'    => ['Í', 'Ì', 'Ỉ', 'Ĩ', 'Ị', 'Î', 'Ï', 'Ī', 'Ĭ', 'Į', 'İ', 'Ι', 'Ί', 'Ϊ', 'Ἰ', 'Ἱ', 'Ἳ', 'Ἴ', 'Ἵ', 'Ἶ', 'Ἷ', 'Ῐ', 'Ῑ', 'Ὶ', 'Ί', 'И', 'І', 'Ї', 'Ǐ', 'ϒ'],
575
            'K'    => ['К', 'Κ'],
576
            'L'    => ['Ĺ', 'Ł', 'Л', 'Λ', 'Ļ', 'Ľ', 'Ŀ', 'ल'],
577
            'M'    => ['М', 'Μ'],
578
            'N'    => ['Ń', 'Ñ', 'Ň', 'Ņ', 'Ŋ', 'Н', 'Ν'],
579
            'O'    => ['Ó', 'Ò', 'Ỏ', 'Õ', 'Ọ', 'Ô', 'Ố', 'Ồ', 'Ổ', 'Ỗ', 'Ộ', 'Ơ', 'Ớ', 'Ờ', 'Ở', 'Ỡ', 'Ợ', 'Ø', 'Ō', 'Ő', 'Ŏ', 'Ο', 'Ό', 'Ὀ', 'Ὁ', 'Ὂ', 'Ὃ', 'Ὄ', 'Ὅ', 'Ὸ', 'Ό', 'О', 'Θ', 'Ө', 'Ǒ', 'Ǿ'],
580
            'P'    => ['П', 'Π'],
581
            'R'    => ['Ř', 'Ŕ', 'Р', 'Ρ', 'Ŗ'],
582
            'S'    => ['Ş', 'Ŝ', 'Ș', 'Š', 'Ś', 'С', 'Σ'],
583
            'T'    => ['Ť', 'Ţ', 'Ŧ', 'Ț', 'Т', 'Τ'],
584
            'U'    => ['Ú', 'Ù', 'Ủ', 'Ũ', 'Ụ', 'Ư', 'Ứ', 'Ừ', 'Ử', 'Ữ', 'Ự', 'Û', 'Ū', 'Ů', 'Ű', 'Ŭ', 'Ų', 'У', 'Ǔ', 'Ǖ', 'Ǘ', 'Ǚ', 'Ǜ'],
585
            'V'    => ['В'],
586
            'W'    => ['Ω', 'Ώ', 'Ŵ'],
587
            'X'    => ['Χ', 'Ξ'],
588
            'Y'    => ['Ý', 'Ỳ', 'Ỷ', 'Ỹ', 'Ỵ', 'Ÿ', 'Ῠ', 'Ῡ', 'Ὺ', 'Ύ', 'Ы', 'Й', 'Υ', 'Ϋ', 'Ŷ'],
589
            'Z'    => ['Ź', 'Ž', 'Ż', 'З', 'Ζ'],
590
            'AE'   => ['Ä', 'Æ', 'Ǽ'],
591
            'CH'   => ['Ч'],
592
            'DJ'   => ['Ђ'],
593
            'DZ'   => ['Џ'],
594
            'GX'   => ['Ĝ'],
595
            'HX'   => ['Ĥ'],
596
            'IJ'   => ['IJ'],
597
            'JX'   => ['Ĵ'],
598
            'KH'   => ['Х'],
599
            'LJ'   => ['Љ'],
600
            'NJ'   => ['Њ'],
601
            'OE'   => ['Ö', 'Œ'],
602
            'PS'   => ['Ψ'],
603
            'SH'   => ['Ш'],
604
            'SHCH' => ['Щ'],
605
            'SS'   => ['ẞ'],
606
            'TH'   => ['Þ'],
607
            'TS'   => ['Ц'],
608
            'UE'   => ['Ü'],
609
            'YA'   => ['Я'],
610
            'YU'   => ['Ю'],
611
            'ZH'   => ['Ж'],
612
            ' '    => ["\xC2\xA0", "\xE2\x80\x80", "\xE2\x80\x81", "\xE2\x80\x82", "\xE2\x80\x83", "\xE2\x80\x84", "\xE2\x80\x85", "\xE2\x80\x86", "\xE2\x80\x87", "\xE2\x80\x88", "\xE2\x80\x89", "\xE2\x80\x8A", "\xE2\x80\xAF", "\xE2\x81\x9F", "\xE3\x80\x80"],
613
        ];
614
    }
615
}
616