We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8a95cba commit ad016b6Copy full SHA for ad016b6
app/helpers.php
@@ -27,7 +27,9 @@ function toBits(float $size, int $precision = 4): float
27
if (! function_exists('percentChange')) {
28
function percentChange(float $dividend, float $divisor, int $precision = 0): string
29
{
30
- if ($dividend === 0 || $divisor === 0) {
+ try {
31
+ $quotient = $dividend / $divisor;
32
+ } catch (DivisionByZeroError $e) {
33
return 0;
34
}
35
@@ -73,7 +75,7 @@ function json_validate($data)
73
75
74
76
if (! empty($data)) {
77
return is_string($data) &&
- is_array(json_decode($data, true)) ? true : false;
78
+ is_array(json_decode($data, true)) ? true : false;
79
80
81
return false;
0 commit comments