Skip to content

Commit 4c03599

Browse files
committed
fix arabic lowercase
1 parent 0874ebd commit 4c03599

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/Investigator.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,19 @@ private function notLowercasesIn(array $array): array
1818
$unwanted = [];
1919

2020
foreach ($array as $word) {
21-
if ($word === '') {
21+
if (is_array($word)) {
22+
array_push($unwanted, ...$this->notLowercasesIn($word));
23+
2224
continue;
2325
}
2426

25-
if (is_array($word)) {
26-
array_push($unwanted, ...$this->notLowercasesIn($word));
27+
$clean = preg_replace('/[^A-Za-z]/', '', $word);
2728

29+
if ($clean == '') {
2830
continue;
2931
}
3032

31-
if (! ctype_lower(preg_replace('/[^A-Za-z]/', '', $word))) {
33+
if (! ctype_lower($clean)) {
3234
$unwanted[] = $word;
3335
}
3436
}

tests/Fixtures/returnsArrayOnlyLowercase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@
1313
'lowercase',
1414
'lower',
1515
'case',
16+
'العربية',
1617
];

0 commit comments

Comments
 (0)