mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-22 10:08:31 -05:00
refactor: count on null
This commit is contained in:
@@ -125,7 +125,7 @@ class BBCodeConverter
|
||||
}
|
||||
$items = \preg_split('#\[\*\]#u', $list);
|
||||
|
||||
$counter = \count($items);
|
||||
$counter = is_countable($items) ? \count($items) : 0;
|
||||
|
||||
if (isset($matches['type']) && $matches['type'] == '=1') { // ordered list
|
||||
// We start from 1 to discard the first string, in fact, it's empty.
|
||||
|
||||
@@ -28,7 +28,7 @@ class EmailBlacklistUpdater
|
||||
$duration = Carbon::now()->addMonth();
|
||||
|
||||
$domains = \json_decode(\file_get_contents($url), true);
|
||||
$count = \count($domains);
|
||||
$count = is_countable($domains) ? \count($domains) : 0;
|
||||
|
||||
// Retrieve blacklisted domains
|
||||
\cache()->put($key, $domains, $duration);
|
||||
|
||||
@@ -69,7 +69,7 @@ class SystemInformation
|
||||
{
|
||||
$bytes = \max($bytes, 0);
|
||||
$pow = \floor(($bytes ? \log($bytes) : 0) / \log(1_024));
|
||||
$pow = \min($pow, \count(self::UNITS) - 1);
|
||||
$pow = \min($pow, (is_countable(self::UNITS) ? \count(self::UNITS) : 0) - 1);
|
||||
// Uncomment one of the following alternatives
|
||||
$bytes /= \pow(1_024, $pow);
|
||||
// $bytes /= (1 << (10 * $pow));
|
||||
|
||||
Reference in New Issue
Block a user