• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

NIT-Administrative-Systems / dynamic-forms / 13506324421

24 Feb 2025 07:35PM UTC coverage: 59.275% (-34.7%) from 94.003%
13506324421

Pull #480

github

nie7321
Update ComponentRegistryTest.php
Pull Request #480: Laravel 12

818 of 1380 relevant lines covered (59.28%)

45.07 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/JSONLogic/LodashFunctions/Math.php
1
<?php
2

3
namespace Northwestern\SysDev\DynamicForms\JSONLogic\LodashFunctions;
4

5
trait Math
6
{
7
    public static function ceil(int | float $number, int $precision = 0): int | float
8
    {
9
        $mult = pow(10, $precision);
×
10
        //the double casting helps keep precision bugs in check, the 4th unit test wouldnt pass without it
11
        //downside is it does limit prection of numbers to 14 sig figs
12
        return ceil(floatval(strval($number * $mult))) / $mult;
×
13
    }
14

15
    public static function divide(int | float $dividend, int | float $divisor): int | float
16
    {
17
        return $dividend / $divisor;
×
18
    }
19

20
    public static function floor(int | float $number, int $precision = 0): int | float
21
    {
22
        $mult = pow(10, $precision);
×
23
        //the double casting helps keep precision bugs in check, the 4th unit test wouldnt pass without it
24
        //downside is it does limit prection of numbers to 14 sig figs
25
        return floor(floatval(strval($number * $mult))) / $mult;
×
26
    }
27

28
    public static function mean(array $array): int | float
29
    {
30
        //lodash return nan on empty array
31
        return count($array) != 0 ? array_sum($array) / count($array) : NAN;
×
32
    }
33

34
    public static function multiply(int | float $multiplier, int | float $multiplicand): int | float
35
    {
36
        return $multiplier * $multiplicand;
×
37
    }
38

39
    public static function round(int | float $number, int $precision = 0): float
40
    {
41
        return round($number, $precision);
×
42
    }
43

44
    public static function subtract(int | float $minuend, int | float $subtrahend): int | float
45
    {
46
        return $minuend - $subtrahend;
×
47
    }
48

49
    public static function sum($array): int | float
50
    {
51
        return array_sum($array);
×
52
    }
53
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc