Skip to content

Commit 37537b9

Browse files
committed
Several codestyle fixes
1 parent 8823ea4 commit 37537b9

29 files changed

+321
-280
lines changed

Tests/InflectorTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
45
* @license GNU General Public License version 2 or later; see LICENSE

Tests/NormaliseTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
45
* @license GNU General Public License version 2 or later; see LICENSE

Tests/StringHelperTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @copyright Copyright (C) 2005 - 2021 Open Source Matters, Inc. All rights reserved.
45
* @license GNU General Public License version 2 or later; see LICENSE

src/Inflector.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Part of the Joomla Framework String Package
45
*

src/Normalise.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Part of the Joomla Framework String Package
45
*

src/StringHelper.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Part of the Joomla Framework String Package
45
*

src/phputf8/mbstring/core.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @package utf8
45
*/

src/phputf8/native/core.php

+96-95
Large diffs are not rendered by default.

src/phputf8/ord.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @package utf8
45
*/
@@ -87,7 +88,7 @@ function utf8_ord($chr)
8788
}
8889

8990
if ($ord0 >= 254 && $ord0 <= 255) {
90-
trigger_error('Invalid UTF-8 with surrogate ordinal '.$ord0);
91+
trigger_error('Invalid UTF-8 with surrogate ordinal ' . $ord0);
9192
return false;
9293
}
9394
}

src/phputf8/str_ireplace.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @package utf8
45
*/
@@ -33,7 +34,7 @@ function utf8_ireplace($search, $replace, $str, $count = null)
3334
$lstr = utf8_strtolower($str);
3435
$i = 0;
3536
$matched = 0;
36-
while (preg_match('/(.*)'.$search.'/Us', $lstr, $matches)) {
37+
while (preg_match('/(.*)' . $search . '/Us', $lstr, $matches)) {
3738
if ($i === $count) {
3839
break;
3940
}

src/phputf8/str_pad.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @package utf8
45
*/

src/phputf8/str_split.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @package utf8
45
*/
@@ -26,6 +27,6 @@ function utf8_str_split($str, $split_len = 1)
2627
return [$str];
2728
}
2829

29-
preg_match_all('/.{'.$split_len.'}|[^\x00]{1,'.$split_len.'}$/us', $str, $ar);
30+
preg_match_all('/.{' . $split_len . '}|[^\x00]{1,' . $split_len . '}$/us', $str, $ar);
3031
return $ar[0];
3132
}

src/phputf8/strcasecmp.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @package utf8
45
*/

src/phputf8/strcspn.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @package utf8
45
*/
@@ -26,7 +27,7 @@ function utf8_strcspn($str, $mask, $start = null, $length = null)
2627
$str = utf8_substr($str, $start, $length);
2728
}
2829

29-
preg_match('/^[^'.$mask.']+/u', $str, $matches);
30+
preg_match('/^[^' . $mask . ']+/u', $str, $matches);
3031

3132
if (isset($matches[0])) {
3233
return utf8_strlen($matches[0]);

src/phputf8/stristr.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @package utf8
45
*/
@@ -24,7 +25,7 @@ function utf8_stristr($str, $search)
2425
$lstr = utf8_strtolower($str);
2526
$lsearch = utf8_strtolower($search);
2627
//JOOMLA SPECIFIC FIX - BEGIN
27-
preg_match('/^(.*)'.preg_quote($lsearch, '/').'/Us', $lstr, $matches);
28+
preg_match('/^(.*)' . preg_quote($lsearch, '/') . '/Us', $lstr, $matches);
2829
//JOOMLA SPECIFIC FIX - END
2930

3031
if (count($matches) == 2) {

src/phputf8/strrev.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @package utf8
45
*/

src/phputf8/strspn.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @package utf8
45
*/
@@ -26,7 +27,7 @@ function utf8_strspn($str, $mask, $start = null, $length = null)
2627
$str = utf8_substr($str, $start, $length);
2728
}
2829

29-
preg_match('/^['.$mask.']+/u', $str, $matches);
30+
preg_match('/^[' . $mask . ']+/u', $str, $matches);
3031

3132
if (isset($matches[0])) {
3233
return utf8_strlen($matches[0]);

src/phputf8/substr_replace.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @package utf8
45
*/

src/phputf8/trim.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @package utf8
45
*/
@@ -24,7 +25,7 @@ function utf8_ltrim($str, $charlist = false)
2425
//quote charlist for use in a characterclass
2526
$charlist = preg_replace('!([\\\\\\-\\]\\[/^])!', '\\\${1}', $charlist);
2627

27-
return preg_replace('/^['.$charlist.']+/u', '', $str);
28+
return preg_replace('/^[' . $charlist . ']+/u', '', $str);
2829
}
2930

3031
//---------------------------------------------------------------
@@ -48,7 +49,7 @@ function utf8_rtrim($str, $charlist = false)
4849
//quote charlist for use in a characterclass
4950
$charlist = preg_replace('!([\\\\\\-\\]\\[/^])!', '\\\${1}', $charlist);
5051

51-
return preg_replace('/['.$charlist.']+$/u', '', $str);
52+
return preg_replace('/[' . $charlist . ']+$/u', '', $str);
5253
}
5354

5455
//---------------------------------------------------------------

src/phputf8/ucfirst.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @package utf8
45
*/
@@ -25,7 +26,7 @@ function utf8_ucfirst($str)
2526
break;
2627
default:
2728
preg_match('/^(.{1})(.*)$/us', $str, $matches);
28-
return utf8_strtoupper($matches[1]).$matches[2];
29+
return utf8_strtoupper($matches[1]) . $matches[2];
2930
break;
3031
}
3132
}

src/phputf8/ucwords.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* @package utf8
45
*/

src/phputf8/utf8.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* This is the dynamic loader for the library. It checks whether you have
45
* the mbstring extension available and includes relevant files

src/phputf8/utils/ascii.php

+53-46
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Tools to help with ASCII in UTF-8
45
*
@@ -66,11 +67,13 @@ function utf8_is_ascii_ctrl($str)
6667
function utf8_strip_non_ascii($str)
6768
{
6869
ob_start();
69-
while (preg_match(
70-
'/^([\x00-\x7F]+)|([^\x00-\x7F]+)/S',
71-
$str,
72-
$matches
73-
)) {
70+
while (
71+
preg_match(
72+
'/^([\x00-\x7F]+)|([^\x00-\x7F]+)/S',
73+
$str,
74+
$matches
75+
)
76+
) {
7477
if (!isset($matches[2])) {
7578
echo $matches[0];
7679
}
@@ -94,11 +97,13 @@ function utf8_strip_non_ascii($str)
9497
function utf8_strip_ascii_ctrl($str)
9598
{
9699
ob_start();
97-
while (preg_match(
98-
'/^([^\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+)|([\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+)/S',
99-
$str,
100-
$matches
101-
)) {
100+
while (
101+
preg_match(
102+
'/^([^\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+)|([\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+)/S',
103+
$str,
104+
$matches
105+
)
106+
) {
102107
if (!isset($matches[2])) {
103108
echo $matches[0];
104109
}
@@ -122,11 +127,13 @@ function utf8_strip_ascii_ctrl($str)
122127
function utf8_strip_non_ascii_ctrl($str)
123128
{
124129
ob_start();
125-
while (preg_match(
126-
'/^([\x09\x0A\x0D\x20-\x7E]+)|([^\x09\x0A\x0D\x20-\x7E]+)/S',
127-
$str,
128-
$matches
129-
)) {
130+
while (
131+
preg_match(
132+
'/^([\x09\x0A\x0D\x20-\x7E]+)|([^\x09\x0A\x0D\x20-\x7E]+)/S',
133+
$str,
134+
$matches
135+
)
136+
) {
130137
if (!isset($matches[2])) {
131138
echo $matches[0];
132139
}
@@ -159,29 +166,29 @@ function utf8_strip_non_ascii_ctrl($str)
159166
* @author Andreas Gohr <[email protected]>
160167
* @package utf8
161168
*/
162-
function utf8_accents_to_ascii($str, $case=0)
169+
function utf8_accents_to_ascii($str, $case = 0)
163170
{
164171
static $UTF8_LOWER_ACCENTS = null;
165172
static $UTF8_UPPER_ACCENTS = null;
166173

167174
if ($case <= 0) {
168175
if (is_null($UTF8_LOWER_ACCENTS)) {
169176
$UTF8_LOWER_ACCENTS = [
170-
'à' => 'a', 'ô' => 'o', 'ď' => 'd', '' => 'f', 'ë' => 'e', 'š' => 's', 'ơ' => 'o',
171-
'ß' => 'ss', 'ă' => 'a', 'ř' => 'r', 'ț' => 't', 'ň' => 'n', 'ā' => 'a', 'ķ' => 'k',
172-
'ŝ' => 's', '' => 'y', 'ņ' => 'n', 'ĺ' => 'l', 'ħ' => 'h', '' => 'p', 'ó' => 'o',
173-
'ú' => 'u', 'ě' => 'e', 'é' => 'e', 'ç' => 'c', '' => 'w', 'ċ' => 'c', 'õ' => 'o',
174-
'' => 's', 'ø' => 'o', 'ģ' => 'g', 'ŧ' => 't', 'ș' => 's', 'ė' => 'e', 'ĉ' => 'c',
175-
'ś' => 's', 'î' => 'i', 'ű' => 'u', 'ć' => 'c', 'ę' => 'e', 'ŵ' => 'w', '' => 't',
176-
'ū' => 'u', 'č' => 'c', 'ö' => 'oe', 'è' => 'e', 'ŷ' => 'y', 'ą' => 'a', 'ł' => 'l',
177-
'ų' => 'u', 'ů' => 'u', 'ş' => 's', 'ğ' => 'g', 'ļ' => 'l', 'ƒ' => 'f', 'ž' => 'z',
178-
'' => 'w', '' => 'b', 'å' => 'a', 'ì' => 'i', 'ï' => 'i', '' => 'd', 'ť' => 't',
179-
'ŗ' => 'r', 'ä' => 'ae', 'í' => 'i', 'ŕ' => 'r', 'ê' => 'e', 'ü' => 'ue', 'ò' => 'o',
180-
'ē' => 'e', 'ñ' => 'n', 'ń' => 'n', 'ĥ' => 'h', 'ĝ' => 'g', 'đ' => 'd', 'ĵ' => 'j',
181-
'ÿ' => 'y', 'ũ' => 'u', 'ŭ' => 'u', 'ư' => 'u', 'ţ' => 't', 'ý' => 'y', 'ő' => 'o',
182-
'â' => 'a', 'ľ' => 'l', '' => 'w', 'ż' => 'z', 'ī' => 'i', 'ã' => 'a', 'ġ' => 'g',
183-
'' => 'm', 'ō' => 'o', 'ĩ' => 'i', 'ù' => 'u', 'į' => 'i', 'ź' => 'z', 'á' => 'a',
184-
'û' => 'u', 'þ' => 'th', 'ð' => 'dh', 'æ' => 'ae', 'µ' => 'u', 'ĕ' => 'e',
177+
'à' => 'a', 'ô' => 'o', 'ď' => 'd', '' => 'f', 'ë' => 'e', 'š' => 's', 'ơ' => 'o',
178+
'ß' => 'ss', 'ă' => 'a', 'ř' => 'r', 'ț' => 't', 'ň' => 'n', 'ā' => 'a', 'ķ' => 'k',
179+
'ŝ' => 's', '' => 'y', 'ņ' => 'n', 'ĺ' => 'l', 'ħ' => 'h', '' => 'p', 'ó' => 'o',
180+
'ú' => 'u', 'ě' => 'e', 'é' => 'e', 'ç' => 'c', '' => 'w', 'ċ' => 'c', 'õ' => 'o',
181+
'' => 's', 'ø' => 'o', 'ģ' => 'g', 'ŧ' => 't', 'ș' => 's', 'ė' => 'e', 'ĉ' => 'c',
182+
'ś' => 's', 'î' => 'i', 'ű' => 'u', 'ć' => 'c', 'ę' => 'e', 'ŵ' => 'w', '' => 't',
183+
'ū' => 'u', 'č' => 'c', 'ö' => 'oe', 'è' => 'e', 'ŷ' => 'y', 'ą' => 'a', 'ł' => 'l',
184+
'ų' => 'u', 'ů' => 'u', 'ş' => 's', 'ğ' => 'g', 'ļ' => 'l', 'ƒ' => 'f', 'ž' => 'z',
185+
'' => 'w', '' => 'b', 'å' => 'a', 'ì' => 'i', 'ï' => 'i', '' => 'd', 'ť' => 't',
186+
'ŗ' => 'r', 'ä' => 'ae', 'í' => 'i', 'ŕ' => 'r', 'ê' => 'e', 'ü' => 'ue', 'ò' => 'o',
187+
'ē' => 'e', 'ñ' => 'n', 'ń' => 'n', 'ĥ' => 'h', 'ĝ' => 'g', 'đ' => 'd', 'ĵ' => 'j',
188+
'ÿ' => 'y', 'ũ' => 'u', 'ŭ' => 'u', 'ư' => 'u', 'ţ' => 't', 'ý' => 'y', 'ő' => 'o',
189+
'â' => 'a', 'ľ' => 'l', '' => 'w', 'ż' => 'z', 'ī' => 'i', 'ã' => 'a', 'ġ' => 'g',
190+
'' => 'm', 'ō' => 'o', 'ĩ' => 'i', 'ù' => 'u', 'į' => 'i', 'ź' => 'z', 'á' => 'a',
191+
'û' => 'u', 'þ' => 'th', 'ð' => 'dh', 'æ' => 'ae', 'µ' => 'u', 'ĕ' => 'e',
185192
];
186193
}
187194

@@ -195,21 +202,21 @@ function utf8_accents_to_ascii($str, $case=0)
195202
if ($case >= 0) {
196203
if (is_null($UTF8_UPPER_ACCENTS)) {
197204
$UTF8_UPPER_ACCENTS = [
198-
'À' => 'A', 'Ô' => 'O', 'Ď' => 'D', '' => 'F', 'Ë' => 'E', 'Š' => 'S', 'Ơ' => 'O',
199-
'Ă' => 'A', 'Ř' => 'R', 'Ț' => 'T', 'Ň' => 'N', 'Ā' => 'A', 'Ķ' => 'K',
200-
'Ŝ' => 'S', '' => 'Y', 'Ņ' => 'N', 'Ĺ' => 'L', 'Ħ' => 'H', '' => 'P', 'Ó' => 'O',
201-
'Ú' => 'U', 'Ě' => 'E', 'É' => 'E', 'Ç' => 'C', '' => 'W', 'Ċ' => 'C', 'Õ' => 'O',
202-
'' => 'S', 'Ø' => 'O', 'Ģ' => 'G', 'Ŧ' => 'T', 'Ș' => 'S', 'Ė' => 'E', 'Ĉ' => 'C',
203-
'Ś' => 'S', 'Î' => 'I', 'Ű' => 'U', 'Ć' => 'C', 'Ę' => 'E', 'Ŵ' => 'W', '' => 'T',
204-
'Ū' => 'U', 'Č' => 'C', 'Ö' => 'Oe', 'È' => 'E', 'Ŷ' => 'Y', 'Ą' => 'A', 'Ł' => 'L',
205-
'Ų' => 'U', 'Ů' => 'U', 'Ş' => 'S', 'Ğ' => 'G', 'Ļ' => 'L', 'Ƒ' => 'F', 'Ž' => 'Z',
206-
'' => 'W', '' => 'B', 'Å' => 'A', 'Ì' => 'I', 'Ï' => 'I', '' => 'D', 'Ť' => 'T',
207-
'Ŗ' => 'R', 'Ä' => 'Ae', 'Í' => 'I', 'Ŕ' => 'R', 'Ê' => 'E', 'Ü' => 'Ue', 'Ò' => 'O',
208-
'Ē' => 'E', 'Ñ' => 'N', 'Ń' => 'N', 'Ĥ' => 'H', 'Ĝ' => 'G', 'Đ' => 'D', 'Ĵ' => 'J',
209-
'Ÿ' => 'Y', 'Ũ' => 'U', 'Ŭ' => 'U', 'Ư' => 'U', 'Ţ' => 'T', 'Ý' => 'Y', 'Ő' => 'O',
210-
'Â' => 'A', 'Ľ' => 'L', '' => 'W', 'Ż' => 'Z', 'Ī' => 'I', 'Ã' => 'A', 'Ġ' => 'G',
211-
'' => 'M', 'Ō' => 'O', 'Ĩ' => 'I', 'Ù' => 'U', 'Į' => 'I', 'Ź' => 'Z', 'Á' => 'A',
212-
'Û' => 'U', 'Þ' => 'Th', 'Ð' => 'Dh', 'Æ' => 'Ae', 'Ĕ' => 'E',
205+
'À' => 'A', 'Ô' => 'O', 'Ď' => 'D', '' => 'F', 'Ë' => 'E', 'Š' => 'S', 'Ơ' => 'O',
206+
'Ă' => 'A', 'Ř' => 'R', 'Ț' => 'T', 'Ň' => 'N', 'Ā' => 'A', 'Ķ' => 'K',
207+
'Ŝ' => 'S', '' => 'Y', 'Ņ' => 'N', 'Ĺ' => 'L', 'Ħ' => 'H', '' => 'P', 'Ó' => 'O',
208+
'Ú' => 'U', 'Ě' => 'E', 'É' => 'E', 'Ç' => 'C', '' => 'W', 'Ċ' => 'C', 'Õ' => 'O',
209+
'' => 'S', 'Ø' => 'O', 'Ģ' => 'G', 'Ŧ' => 'T', 'Ș' => 'S', 'Ė' => 'E', 'Ĉ' => 'C',
210+
'Ś' => 'S', 'Î' => 'I', 'Ű' => 'U', 'Ć' => 'C', 'Ę' => 'E', 'Ŵ' => 'W', '' => 'T',
211+
'Ū' => 'U', 'Č' => 'C', 'Ö' => 'Oe', 'È' => 'E', 'Ŷ' => 'Y', 'Ą' => 'A', 'Ł' => 'L',
212+
'Ų' => 'U', 'Ů' => 'U', 'Ş' => 'S', 'Ğ' => 'G', 'Ļ' => 'L', 'Ƒ' => 'F', 'Ž' => 'Z',
213+
'' => 'W', '' => 'B', 'Å' => 'A', 'Ì' => 'I', 'Ï' => 'I', '' => 'D', 'Ť' => 'T',
214+
'Ŗ' => 'R', 'Ä' => 'Ae', 'Í' => 'I', 'Ŕ' => 'R', 'Ê' => 'E', 'Ü' => 'Ue', 'Ò' => 'O',
215+
'Ē' => 'E', 'Ñ' => 'N', 'Ń' => 'N', 'Ĥ' => 'H', 'Ĝ' => 'G', 'Đ' => 'D', 'Ĵ' => 'J',
216+
'Ÿ' => 'Y', 'Ũ' => 'U', 'Ŭ' => 'U', 'Ư' => 'U', 'Ţ' => 'T', 'Ý' => 'Y', 'Ő' => 'O',
217+
'Â' => 'A', 'Ľ' => 'L', '' => 'W', 'Ż' => 'Z', 'Ī' => 'I', 'Ã' => 'A', 'Ġ' => 'G',
218+
'' => 'M', 'Ō' => 'O', 'Ĩ' => 'I', 'Ù' => 'U', 'Į' => 'I', 'Ź' => 'Z', 'Á' => 'A',
219+
'Û' => 'U', 'Þ' => 'Th', 'Ð' => 'Dh', 'Æ' => 'Ae', 'Ĕ' => 'E',
213220
];
214221
}
215222
$str = str_replace(

0 commit comments

Comments
 (0)