Skip to content

Commit 6bdf430

Browse files
authored
Merge pull request #135 from systeminc/analysis-XkgokG
Apply fixes from StyleCI
2 parents 715cc56 + e532a6c commit 6bdf430

File tree

1 file changed

+33
-29
lines changed

1 file changed

+33
-29
lines changed

src/Traits/HelpersTrait.php

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -176,18 +176,20 @@ public function consoleSignature()
176176
$this->line('');
177177
}
178178

179-
public function cleanSpecialChars($string) {
180-
$dict = array(
181-
"I'm" => "I am",
182-
"thier" => "their",
183-
);
179+
public function cleanSpecialChars($string)
180+
{
181+
$dict = [
182+
"I'm" => 'I am',
183+
'thier' => 'their',
184+
];
185+
184186
return strtolower(
185187
preg_replace(
186-
array( '#[\\s-]+#', '#[^A-Za-z0-9\. -]+#' ),
187-
array( '-', '' ),
188+
['#[\\s-]+#', '#[^A-Za-z0-9\. -]+#'],
189+
['-', ''],
188190
// the full cleanString() can be download from http://www.unexpectedit.com/php/php-clean-string-of-utf8-chars-convert-to-similar-ascii-char
189191
$this->cleanString(
190-
str_replace( // preg_replace to support more complicated replacements
192+
str_replace(// preg_replace to support more complicated replacements
191193
array_keys($dict),
192194
array_values($dict),
193195
urldecode($string)
@@ -197,27 +199,29 @@ public function cleanSpecialChars($string) {
197199
);
198200
}
199201

200-
private function cleanString($text) {
201-
$utf8 = array(
202-
'/[áàâãªä]/u' => 'a',
203-
'/[ÁÀÂÃÄ]/u' => 'A',
204-
'/[ÍÌÎÏ]/u' => 'I',
205-
'/[íìîï]/u' => 'i',
206-
'/[éèêë]/u' => 'e',
207-
'/[ÉÈÊË]/u' => 'E',
208-
'/[óòôõºö]/u' => 'o',
209-
'/[ÓÒÔÕÖ]/u' => 'O',
210-
'/[úùûü]/u' => 'u',
211-
'/[ÚÙÛÜ]/u' => 'U',
212-
'/ç/' => 'c',
213-
'/Ç/' => 'C',
214-
'/ñ/' => 'n',
215-
'/Ñ/' => 'N',
216-
'/–/' => '-', // UTF-8 hyphen to "normal" hyphen
217-
'/[’‘‹›‚]/u' => ' ', // Literally a single quote
218-
'/[“”«»„]/u' => ' ', // Double quote
219-
'/ /' => ' ', // nonbreaking space (equiv. to 0x160)
220-
);
202+
private function cleanString($text)
203+
{
204+
$utf8 = [
205+
'/[áàâãªä]/u' => 'a',
206+
'/[ÁÀÂÃÄ]/u' => 'A',
207+
'/[ÍÌÎÏ]/u' => 'I',
208+
'/[íìîï]/u' => 'i',
209+
'/[éèêë]/u' => 'e',
210+
'/[ÉÈÊË]/u' => 'E',
211+
'/[óòôõºö]/u' => 'o',
212+
'/[ÓÒÔÕÖ]/u' => 'O',
213+
'/[úùûü]/u' => 'u',
214+
'/[ÚÙÛÜ]/u' => 'U',
215+
'/ç/' => 'c',
216+
'/Ç/' => 'C',
217+
'/ñ/' => 'n',
218+
'/Ñ/' => 'N',
219+
'/–/' => '-', // UTF-8 hyphen to "normal" hyphen
220+
'/[’‘‹›‚]/u' => ' ', // Literally a single quote
221+
'/[“”«»„]/u' => ' ', // Double quote
222+
'/ /' => ' ', // nonbreaking space (equiv. to 0x160)
223+
];
224+
221225
return preg_replace(array_keys($utf8), array_values($utf8), $text);
222226
}
223227
}

0 commit comments

Comments
 (0)