refactor: count on null

This commit is contained in:
HDVinnie
2020-07-22 16:41:51 -04:00
parent 805ce0bfda
commit aea25ecf2f
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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));