mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Misc/Fixup
* floating changes * condense several switch() into match() constructs * fix ucFirst not making the rest of the word lowercase
This commit is contained in:
@@ -1488,15 +1488,15 @@ class ItemList extends BaseType
|
||||
{
|
||||
$mask = $this->curTpl['scalingStatValue'];
|
||||
|
||||
switch ($type)
|
||||
$mask &= match ($type)
|
||||
{
|
||||
case 'stats': $mask &= 0x04001F; break;
|
||||
case 'armor': $mask &= 0xF001E0; break;
|
||||
case 'dps' : $mask &= 0x007E00; break;
|
||||
case 'spell': $mask &= 0x008000; break;
|
||||
case 'fap' : $mask &= 0x010000; break; // unused
|
||||
default: $mask &= 0x0;
|
||||
}
|
||||
'stats' => 0x04001F,
|
||||
'armor' => 0xF001E0,
|
||||
'dps' => 0x007E00,
|
||||
'spell' => 0x008000,
|
||||
'fap' => 0x010000, // unused
|
||||
default => 0x0
|
||||
};
|
||||
|
||||
$field = null;
|
||||
for ($i = 0; $i < count(Util::$ssdMaskFields); $i++)
|
||||
|
||||
@@ -550,22 +550,21 @@ abstract class Util
|
||||
return Lang::item('ratingString', [$statId, $result, $level]);
|
||||
}
|
||||
|
||||
// default ucFirst doesn't convert UTF-8 chars
|
||||
public static function ucFirst($str)
|
||||
// default ucFirst doesn't convert UTF-8 chars (php 8.4 finally implemented this .. see ya in 2027)
|
||||
public static function ucFirst(string $str) : string
|
||||
{
|
||||
$len = mb_strlen($str) - 1;
|
||||
$first = mb_substr($str, 0, 1);
|
||||
$rest = mb_substr($str, 1, $len);
|
||||
$rest = mb_substr($str, 1);
|
||||
|
||||
return mb_strtoupper($first).$rest;
|
||||
return mb_strtoupper($first).mb_strtolower($rest);
|
||||
}
|
||||
|
||||
public static function ucWords($str)
|
||||
public static function ucWords(string $str) : string
|
||||
{
|
||||
return mb_convert_case($str, MB_CASE_TITLE);
|
||||
}
|
||||
|
||||
public static function lower($str)
|
||||
public static function lower(string $str) : string
|
||||
{
|
||||
return mb_strtolower($str);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user